By godotislate on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
11.5.x
Introduced in version:
11.5.0
Issue links:
Description:
If a wait time is passed to Drupal.debounce(), then at runtime it is possible that between when debounce() is called and when the function passed to debounce runs, other code makes state changes. This can cause errors when the function is run, if the function is not expecting these changes.
To help avoid this, debounce now has a cancel() method that will prevent the passed function from being run. To use, store object returned from the debounce call as a variable, and then call the cancel method on that variable after the state change.
Impacts:
Module developers