facebook / facebook/relay

useLazyLoadQuery won't reload when app code throws error

Open
#3,575 2 comments 8 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

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:
1) calls commitLocalUpdate and calls invalidateStore() on the store.
2) Increments the query keys for EVERY query in the app.
3) Remounts the children

Here is what we are seeing:
1) 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).
2) A new request **IS** made, as expected.
3) When suspense resolves, the OLD data is returned (with the null values still). <--- THIS IS UNEXPECTED

See [reproduction case](https://github.com/chriserickson/relay-cant-recover-from-error)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.