You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
follow-up: slow and fast debounced methods are independent in getParticipants #11048
this.debounceSlowUpdateParticipants and this.debounceFastUpdateParticipants seem to have a different context, so if both are requested, both will be executed
https://www.npmjs.com/package/debounce library has clear() and flush() methods, although it either cancel both requests or none of them, depending on usage.
This potentially could save 1+ request to server, depending on conditions
Or use flags ( e.g: isFetchedAlready). As fast comes after slow ( at least at the start of the call) :
When fast debounce starts excecuting, it puts isFetchedAlready = true. Then , the previously last scheduled slow debounce has to check the flag. If it is true, then skip.
But we need to fetch in the future again. When would it be reset?
So once the flag is checked in slow debounce and it was true, you reset to false inside that check. That slow debounce call is the last one before fast debounces. When the call ends ( thus fast debounces end), the slow debounce finds the flag already false so it works normally.
In other terms, it uses the fact that the first fast debounce ( where the flag value is changed) marks the end of slow debounce.
Activity
DorraJaouad commentedon Dec 1, 2023
Or use flags ( e.g: isFetchedAlready). As fast comes after slow ( at least at the start of the call) :
When fast debounce starts excecuting, it puts isFetchedAlready = true. Then , the previously last scheduled slow debounce has to check the flag. If it is true, then skip.
nickvergessen commentedon Dec 1, 2023
But we need to fetch in the future again. When would it be reset?
DorraJaouad commentedon Dec 1, 2023
So once the flag is checked in slow debounce and it was true, you reset to false inside that check. That slow debounce call is the last one before fast debounces. When the call ends ( thus fast debounces end), the slow debounce finds the flag already false so it works normally.
In other terms, it uses the fact that the first fast debounce ( where the flag value is changed) marks the end of slow debounce.