T
TanStack•7mo ago
fascinating-indigo

No shouldThrow option for useRouteContext

The useRouterContext hook sometimes throws a invariant error. I see in the source code that it uses useMatch, but there is currently no way for me now to pass shouldThrow as false to that useMatch. Could that be added as a possible property for useRouteContext?
6 Replies
ambitious-aqua
ambitious-aqua•7mo ago
sure want to create a PR for that?
fascinating-indigo
fascinating-indigoOP•7mo ago
Sure, should have some time later today
fascinating-indigo
fascinating-indigoOP•7mo ago
Added a PR -> https://github.com/TanStack/router/pull/3647 I am not very used to working with complex types like this, so I hope I did it correctly 😅 Let me know if I need to change/add anything
GitHub
feat(router): add shouldThrow to useRouteContext options by AaronCl...
What Added the shouldThrow property to useRouteContext. Why useRouteContext uses useMatch, which can throw an invariant exception.
fascinating-indigo
fascinating-indigoOP•7mo ago
Anything else I should do for this?
ambitious-aqua
ambitious-aqua•7mo ago
sorry I did not have time for a review
fascinating-indigo
fascinating-indigoOP•7mo ago
No worries, not that urgent, just making sure I wasnt missing anything 🙂

Did you find this page helpful?