28
Views
1
Comments
[Debounce Reactive] Invalid call of the client action
debounce
Reactive icon
Forge asset by Vincent Koning
Application Type
Reactive

When using debounce and setting the DebounceDelay to a high number and navigating away from the page before the delay is triggered results in this error message.

Invalid call of the 'CallEvent' client action of the 'MainFlow.Debounce' since the latter is not currently active. This is likely due to a platform's client action being used as an event handler or in a setTimeout function. Consider removing this call by using the 'On Destroy' event of the screen/block or moving your logic to a global client action. 

A possible solution is to add a mutation observer that watch for changes in the DOM and If the widget is removed, the debounce timer is cleared, and the observer is disconnected. 

My modified version looks like this and seems to work so far

Debounce-custom.txt
UserImage.jpg
Heinrich Wentzel

A cleaner solution might be to check if the widget still exists on the DOM before executing the function.

Debounce-custom.txt
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.