#How can I get route context in on*?
10 messages · Page 1 of 1 (latest)
you get the match passed in which has the context, right?
Not if I'm understanding the docs right https://tanstack.com/router/v1/docs/api/router/RouteOptionsType#onerror-property
The RouteOptions type is used to describe the options that can be used when creating a route. RouteOptions properties The RouteOptions type accepts an object with the following properties: getParentRo...
I was looking at onError and onCatch. I see that others have the RouteMatch
yeah those dont get it
there is no guarantuee that context is available at this point
could maybe be passed in as optional?
there is no guarantuee that context is available at this point
You mean in the sense that some code in tanstack router could fail before getting to user-provided code such that the context isn't available?
Alternatively, thinking about what could be done to do dependency injection for route construction if onCatch / onError do not receive the route context. I could use a singleton but then I'd have to do module mocking in tests, which I'd like to avoid
You mean in the sense that some code in tanstack router could fail before getting to user-provided code such that the context isn't available?
no it could be that your beforeLoad throws for example and then route context is not (fully) availabl