T
TanStack•9mo ago
genetic-orange

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
xenial-black
xenial-black•9mo ago
sure want to create a PR for that?
genetic-orange
genetic-orangeOP•9mo ago
Sure, should have some time later today
genetic-orange
genetic-orangeOP•9mo 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.
genetic-orange
genetic-orangeOP•9mo ago
Anything else I should do for this?
xenial-black
xenial-black•9mo ago
sorry I did not have time for a review
genetic-orange
genetic-orangeOP•9mo ago
No worries, not that urgent, just making sure I wasnt missing anything 🙂

Did you find this page helpful?