Replies: 2 comments
-
I have a similar use-case using a createRoute({
path: 'navigation/$',
params: {
stringify: () => {
// ...
},
parse: ({ _splat }) => {
const [folderId, documentId, ...rest] = (_splat || '').split('/');
if (rest.length) {
notFound({ throw: true });
}
// ...
},
},
}) |
Beta Was this translation helpful? Give feedback.
0 replies
-
I have a similar use-case. Would be nice if there would be official support for this in tanstack-router. |
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.
-
I'd love to
throw notFound()
like in the example above.We have params we know must be valid integers above 0, UUIDs, or enum values for example.
We run assertions to ensure we can narrow the type correctly when it's passed down to
beforeLoad
,loader
, or accessed viaRoute.useParams()
.Right now we throw an error, which means invalid params will display the error component.
Displaying the error page makes it look like there's a bug in our app, when it's not the case.
Displaying the not found page is what we'd expect, and better communicates to the end user what's happening.
Not sure why it's not allowed currently.
Beta Was this translation helpful? Give feedback.
All reactions