Meta route options is gone?
Describe the bug
Firstly, thanks a lot for an awesome tool! Have wanted this in react for ages!
In the alpha release ^0.0.1-alpha.0 we have a meta property on route options.
I see in v1 that this is gone.
But then the docs do still mention Dynamic meta tag management and I am wondering
- Is meta tagging still available but moved?
- Just removed?
- Replaced with something else?
Below I show an example of how I was using meta options.
Then type safety using this
This was working well, but maybe theres is a different/better way to do this now?
Thanks :)
Your Example Website or App
N/A
Steps to Reproduce the Bug or Issue
- Install latest version of
@tanstack/react-router^1.6.0 - Meta options is gone from
RouteOptions
Expected behavior
Meta options still available on RouteOptions
Screenshots or Videos
No response
Platform
- OS: [e.g. macOS, Windows, Linux]
- Browser: [e.g. Chrome, Safari, Firefox]
- Version: [e.g. 91.1]
Additional context
N/A
I was also using this to generate the menu structure in my app, from the route tree.
I haven't been able to find a way to get it working with RouteContext, as it seems like this isn't usable outside the <Outlet/>.
EDIT: This was also discussed here previously: https://github.com/TanStack/router/discussions/760
cc @schiller-manuel
You can now use the newly added staticData route option: https://tanstack.com/router/latest/docs/framework/react/guide/static-route-data
Hey @tannerlinsley, would it be possible to enforce static data at a Route level?
For example, if I define a /_layout, that all /_layout/<children> must include that static data; while if there's another /_other-layout, such static data is not enforced.
Possible, but it’ll take some work.
Do you mean that it will take work to be added to the library? Not that I'm in a hurry for anything, I was just wondering.
Correct!
Hey @tannerlinsley thanks a lot for the response.
Replaced meta with staticData everything seems to work fine :)
And better yet, it’s available right in the match!
@tannerlinsley I can open a new issue if you'd like, but is it intentional that the types don't support doing this with lazy routes? If I ignore the type errors, it works just fine.
You need to create both routes, a lazy one and non-lazy one.
Put staticData into the non-lazy one. see also https://tanstack.com/router/latest/docs/framework/react/guide/code-splitting#how-does-tanstack-router-split-code