Can I fetch then render/navigate?
iOS uses this pattern a lot
I click an item, it shows a spinner in the item, then I can navigate once it’s been loaded (see video)
If I fetch data one off with convex.query, will useQuery have that data preloaded on the next page upon navigating to it?
6 Replies
Not out of the box, but there's a helper that does this: https://github.com/get-convex/convex-helpers/blob/main/packages/convex-helpers/README.md#query-caching
GitHub
convex-helpers/packages/convex-helpers/README.md at main · get-con...
A collection of useful code to complement the official packages. - get-convex/convex-helpers
Would I need to wrap something in a useEffect and then navigate once I got a result?
I haven't tried, but that sounds like a fringe scenario where you may or may not get a sub-second lead on the query resolving. Recommend just trying it and seeing if it meaningfully improves your experience.
Sometimes on nav there is an animation/push to the next page and it can be funky if there is any ui change on that page as it slides over
from loading to resolved for example
As opposed to waiting for the page to be ready and then animating it over'
gotcha - the helper I linked should resolve that