reset error boundary if query succeeded
If I have a query that is being used in multiple parts of the same page, and if it fails, I want error boundaries to catch those components and render fallbacks.
But if the user presses
Try Again on one of the queries, only that boundry is reset if the query is sucessful. The rest of the components are still rendering the fallback.
Is there anyway to have all the error boundaries reset?4 Replies
generous-apricot•3y ago
are you using separate
QueryErrorResetBoundaries ?harsh-harlequinOP•3y ago
I've tried it in every combination I can think of, the
Try Again button resets the query but doesn't cause the other boundary to re-render.
For context, both <Portfolio /> and <Positions /> are using the same query, with the same query keyharsh-harlequinOP•3y ago
https://suspensive.org/docs/react/src/ErrorBoundaryGroup.i18n#witherrorboundarygroup-useerrorboundarygroup
This actually solves my issue, not sure if there is a better way though
ErrorBoundaryGroup | Suspensive
This is a component for managing multiple ErrorBoundaries at once.
harsh-harlequinOP•3y ago
This is what my solution was, it doesn't feel right
Using
useSuspenseQuery in <Portfolio /> and <Positions />, both are using the same query+key