Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Offline apps behave in a strange way, sometimes showing error pages even though they should not.
The offline mode of TanStack Query works fine in a standalone example, so the problems come from react-admin.
Solution
Build a demo, track down the issues and fix them.
When offline, all calls to useQuery return an error... but they also return data.
In a nutshell, we must not only check for errors before deciding to show/return things but also that no data is available for offline support to work correctly
If we have a NetworkError and valid data, it means we're offline and that TanStack query returned stale data.
How To Test
(the offline mode doesn't work in dev mode, that's a limitation of vite-pwa)
Describe the steps required to test the changes
Additional Checks
masterfor a bugfix or a documentation fix, ornextfor a feature