Replies: 1 comment
-
Closing this as a duplicate of #9881 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When a React error boundary catches an error with
componentDidCatch
, it receives two pieces of information:In a
react-router
,useRouteError
provides access to theerror
, but I can't see a way to access theinfo
. I've therefore reluctantly voted for #10166 as a way to eject from react-router's error catching, but I'd retract that vote ifreact-router
could give me theinfo
object.Possible solutions, trying to avoid breaking changes:
useRouteReactErrorInfo
)useRouteError({ includeReactErrorInfo: true })
) that makesuseRouteError
return structured information when the error is from a React error boundaryinfo
to theerror
Object as it passes through the React error boundaryuseRouteError
return theerror
on the first time it's called within a render, andinfo
(or nothing, for non-rendering errors) on the secondEDIT: On reflection, for our use case, we don't actually need the data for rendering (just for logging), so a
RouterProvider
-level callback would also work great.Beta Was this translation helpful? Give feedback.
All reactions