Preloading queries caching
I have routes that i'd like to pre-render and cache requests about my users in convex, but some of these are "forms" that the data might be updated live so I want that to be reactive.
I've seen in the docs that there is both
fetchQuery and preloadQuery and that you can then use the value from preloadQuery. My goal for prerendering is two fold:- faster inital page load for cached routes
- eliminate "jank" when data pops in, even if it's fast (like it would with
useQuery).In my implementation, it doesn't seem like
preloadQuery is doing much except for stopping jank when I reload, and I know in the docs it says that preloadQuery basically disables caching for the route as a whole. My question/suggestion:
Wouldn't it be better to just
fetchQuery and then replace that response when a useQuery comes in? We can still cache/invalidate as needed, and then just rely on useQuery for real-time updates.It would make it much easier for me to default to
fetchQuery and then just activate the "real-time" as needed. I think this might go against some of the ways that the Convex team thinks about their product as whole, but I would interested in other users/maintainers feedback here. Am I thinking about these tools wrong?
