orbitjs / orbit

Composable data framework for ambitious web applications.
https://orbitjs.com
MIT License
2.33k stars 134 forks source link

fix: check whether tick has been removed before execution of liveQuery subscription #991

Open Michiel87 opened 1 year ago

Michiel87 commented 1 year ago

There might be a problem with the timing of unsubscription and the execution of the debounced function. If the unsubscribe function is called at a moment when the debounced function has already been scheduled to be executed but hasn't yet executed, it won't stop the function from executing.

This is due to the fact that the execute function is only canceled by cancelTick which is removing it from ticks, but it doesn't actually stop it if it's already been scheduled.

I've added a condition to account for this.