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
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When a React error boundary catches an error with
componentDidCatch, it receives two pieces of information:In a
react-router,useRouteErrorprovides 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-routercould give me theinfoobject.Possible solutions, trying to avoid breaking changes:
useRouteReactErrorInfo)useRouteError({ includeReactErrorInfo: true })) that makesuseRouteErrorreturn structured information when the error is from a React error boundaryinfoto theerrorObject as it passes through the React error boundaryuseRouteErrorreturn theerroron 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