Updating fig.x_range.factors after patching ColumnDataSource

Hello!

I need your help.
How would it be correct to update x_range.factors after patching CDS of datatable?
User changes name of one column and xticks (and factors) should update according to new name of a factor.

Here is an example:
https://pastebin.com/rZEAsdAq

And how it “works”:

It’s continuation of the post on StackOverFlow.

Thank you!

If you are going to cross-post, please make sure that you include all details in both posts. Also, in general, please avoid “continuations”. Make every question separate, independent, and complete. Otherwise it is hard for people who might want to answer, and also hard for future readers who might want to follow along.