[Bug?]: createAsync()
or query()
not working properly when using reactive params?
#1691
Open
2 tasks done
Labels
bug
Something isn't working
Duplicates
Latest version
Current behavior 😯
(see Stackblitz example in repro section)
active
/inactive
filter by clicking the button multiple times with 5+ seconds breaks between clicksExpected behavior 🤔
(see Stackblitz example in repro section)
Steps to reproduce 🕹
Stackblitz Demo
Context 🔦
(I'm new to Solidjs and Solid-Start.)
I was following the data loading example from the latest (Beta) docs, which works fine:
https://docs.solidjs.com/solid-start/building-your-application/data-loading#data-loading-always-on-the-server
I tried adding some reactive parameters to the server function. Unfortunately the caching of the
query()
function isn't working as expected. Please find the Stackblitz example in the reproduction section!(I was also able to reproduce this on my local machine in another project using the latest solid-start package 1.0.10)
Am I doing something wrong?
It would be great if you could also add a
data loading with reactive params
example to the docs?Notes:
I think this issue caused by using a combination of
createAsync
+query
+signals
?As far as I can tell this code is causing the issue:
https://github.com/solidjs/solid-router/blob/main/src/data/query.ts#L100-L112
(For some reason the function inside
onCleanup(() => cached[4].count--);
is called causing count to be zero andDate.now() - cached[0] < PRELOAD_TIMEOUT
is causing this weird 5 second working caching behaviour)PS:
@ryansolid and team: Thanks for creating this framework. Keep up the great work! I'll keep watching your streams on youtube.
Your environment 🌎
The text was updated successfully, but these errors were encountered: