powersync-js
powersync-js copied to clipboard
update: using Datastream to queue onResult callbacks in watchWithCallback
Description
Piggybacking on Steven's Datastream implementation.
This allows the watch to ensure that onResult callbacks are completed in the order in which they are triggered. For example, if the initial result takes long to complete it would block the second onResult call until it is done (This was a possible bug in the existing implementation where the initial result could complete after the second onResult leading to the result state being empty).