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:

And how it “works”:
https://imgur.com/a/cdeVkZV

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.