[✨] Skip q-data.json fetches where possible #154
cmbartschat
started this conversation in
Proposals For Qwik
Replies: 3 comments
-
|
Beta Was this translation helpful? Give feedback.
0 replies
-
We moved this issue to |
Beta Was this translation helpful? Give feedback.
0 replies
-
thanks for the improvement request thanks again! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is your feature request related to a problem?
It seems that currently, any navigation (including changing query params), will trigger a q-data.json fetch.
There is good reason to do this (even if there are no loaders), for example if there is a plugin/middleware that might redirect.
However, when there are no loaders, plugins, or middleware, it seems like skipping the q-data.json fetch when navigating within an "known path" should not re-fetch.
This can be seen on this stackblitz - switching the active file is stored as a query param, but that forces us to continually re-fetch q-data.json from the server which adds latency to rendering.
Describe the solution you'd like
One potential solution is for q-data.json to return an extra bit indicating "this path is completely inert", and the framework on the client will see that and know that there's no need to ever refetch it, even if a query param changed. It would be nice if it worked for wildcard routes as well.
Describe alternatives you've considered
Another alternative is to use the browser-level history APIs it doesn't force a q-data fetch.
Stackblitz showing the workaround
The code is slightly uglier but it's still server-side rendered at least, only problem is that it makes the back button into a full reload rather than client-side. Maybe there's a further improvement there. If this can be solved in user space with a convenience hook like
useClientLocation
/useClientNavigate
, maybe this isnt a huge deal but yeah.Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions