I have a sort of racing condition when using HOT that causes not all changes to be visible during the data processing.
The general scenario is as follows:
- Enter cell editor and type in some changes you are interesed in (eg required field)
- Click external SAVE button (loose focus on the editor), that triggers validation which is as below
- Get table data
- Validate
- Provide feedback to the user.
The problem is that between 1 and 2, HOT sometimes does not manage to update its internal data state (editor changes not yet applied) so it sometimes works and the last change is visible in 3, and sometimes it does not as it is delayed.
I have kind of confirmed it by adding afterChange hook log message which results in:
and sometimes it works correctly and the order is as you would expect
Now, how can I either force HOT to get a grip and apply all pending changes/events right here right now, or how can I wait/delay execution of my code until beeing sure that HOT have done all of its stuff?
I have checked that beforeChange
is much more reliable and it called before my code is beeing executed. Should I wait for beforeChange/afterChange events pairs to be sure that processing is done?