afterFilter - distinguishing user triggered changes from programmatic changes

Tags: #<Tag:0x00007efc6ae549e0>

Hi,

"@handsontable/react": "^11.0.1",
"handsontable": "^11.0.1",

I’m trying to save filter settings in state to restore filters when react component update.
I use afterFilter hook to save filterStack to state and then when I need to restore it, I use

  const plu = hot.getPlugin('Filters');
  plu.clearConditions();
  for (const filter of this.state.filterStack) {
    plu.addCondition(filter.column, filter.conditions[0].name, filter.conditions[0].args[0]);
  } 
  plu.filter();

The problem is that when I run filter(), this also triggers afterFilter and I get into a loop.

Is there any way to distinguish whether afterFilter was caused by user action or by programmatic change?

Thank you,

Hi @marek.kowalczyk

Unfortunately at the moment React state management isn’t working as it should with Handsontable, you can read more about this topic here: https://github.com/handsontable/handsontable/issues/8372

We will address that issue as soon as possible.

I am happy to announce that the epic at https://github.com/handsontable/handsontable/issues/8372 is solved in v12. If you would have any issues with updating to the newest version please contact us at support@handsontable.com