Open a-jaouen opened 2 years ago
The asyncThrottle function used by createAsyncStoragePersistor is not working as expected.
asyncThrottle
createAsyncStoragePersistor
https://github.com/SvelteStack/svelte-query/blob/76d0591cbe6699329103db75f95427b48b507991/src/queryCore/createAsyncStoragePersistor-experimental/index.ts#L37
Behaviour: It will just delay the persistClient function with throttleTime but won't limit the number of concurrent call to 1.
persistClient
throttleTime
Result: The data is not persisted correctly when multiple useQuery are used simultaneously.
Solution: I used the lodash throttle function instead and it is working like a charm. The persistence is working great as well.
The
asyncThrottle
function used bycreateAsyncStoragePersistor
is not working as expected.https://github.com/SvelteStack/svelte-query/blob/76d0591cbe6699329103db75f95427b48b507991/src/queryCore/createAsyncStoragePersistor-experimental/index.ts#L37
Behaviour: It will just delay the
persistClient
function withthrottleTime
but won't limit the number of concurrent call to 1.Result: The data is not persisted correctly when multiple useQuery are used simultaneously.
Solution: I used the lodash throttle function instead and it is working like a charm. The persistence is working great as well.