feat: add prefetch queries for projects and device info #104
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
towards #1345
There are some long wait times in the mobile app, in particular for the All Projects screen and the Exchange Screen.
Rather than right something hacky in mobile, it was suggested that we expose some prefetchQueries so that loading certain screens won't take as long.
So this PR adds one file with some prefetch helpers for the needed calls.
These are then exported so they can be used on focus in mobile.
I also did my best to make sure the api docs would work and would look similar to what already exists in here.
These helpers are not hooks and perform no subscription/side-effects beyond priming cache. It's all an addition so should not change anything (except the api docs) that already exists.
Questions:
staleTime
configurabilityRight now it’s hard-coded to Infinity to guarantee zero re-fetch during the menu focus window.
Would you prefer we accept an optional staleTime argument (defaulting to Infinity) so mobile can send it in
Tests
Since nothing is returned I wasn't sure what/ how to test but I am open to suggestions!
Placement / naming
Kept these as small “lib/react-query” utilities and re-exported from the index. If you want them grouped differently, I can adjust. Just let me know.