relay
relay copied to clipboard
useLazyLoadQuery won't reload when app code throws error
Context: Given a query that is returning a partial response that, due to a bug in some view code, throws to an error boundary.
We'd like to generically be able to retry all queries (from the error boundary) to see if the backend has recovered.
Currently, the try-again code does the following:
- calls commitLocalUpdate and calls invalidateStore() on the store.
- Increments the query keys for EVERY query in the app.
- Remounts the children
Here is what we are seeing:
- The component DOES suspend, as expected. I believe this is a result of invalidating the store (otherwise it doesn't suspend, even when incrementing the fetchKey due to store-or-network being the default policy).
- A new request IS made, as expected.
- When suspense resolves, the OLD data is returned (with the null values still). <--- THIS IS UNEXPECTED
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
any news on this? I've bumped into the same kind of error, I wanted to use @required(action: THROW)
as a way to detect if a user was logged in, catch when it's not the case in an error boundary to show a login page and refetch the data once the user has logged in. The whole thing was really elegant, but unfortunately, even though the right data is fetched, the UI still reflects the old data before login, so the user has to manually refresh the page, it destroys the whole benefit.