-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: update error handling in MatchInner to access error data directly #4746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
View your CI Pipeline Execution ↗ for commit 0b6cccb
☁️ Nx Cloud last updated this comment at |
More templates
@tanstack/arktype-adapter
@tanstack/directive-functions-plugin
@tanstack/eslint-plugin-router
@tanstack/history
@tanstack/react-router
@tanstack/react-router-devtools
@tanstack/react-router-with-query
@tanstack/react-start
@tanstack/react-start-client
@tanstack/react-start-plugin
@tanstack/react-start-server
@tanstack/router-cli
@tanstack/router-core
@tanstack/router-devtools
@tanstack/router-devtools-core
@tanstack/router-generator
@tanstack/router-plugin
@tanstack/router-utils
@tanstack/router-vite-plugin
@tanstack/server-functions-plugin
@tanstack/solid-router
@tanstack/solid-router-devtools
@tanstack/solid-start
@tanstack/solid-start-client
@tanstack/solid-start-plugin
@tanstack/solid-start-server
@tanstack/start-client-core
@tanstack/start-plugin-core
@tanstack/start-server-core
@tanstack/start-server-functions-client
@tanstack/start-server-functions-fetcher
@tanstack/start-server-functions-server
@tanstack/start-storage-context
@tanstack/valibot-adapter
@tanstack/virtual-file-routes
@tanstack/zod-adapter
commit: |
Signed-off-by: leesb971204 <[email protected]>
04e715a
to
f907711
Compare
Signed-off-by: leesb971204 <[email protected]>
return <router.options.defaultNotFoundComponent data={data} /> | ||
return <router.options.defaultNotFoundComponent {...data} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part causes the structure to become nested like data: { data: ... }
.
export type NotFoundRouteProps = { | ||
// TODO: Make sure this is `| null | undefined` (this is for global not-founds) | ||
data: unknown | ||
} | ||
export type NotFoundRouteProps = Partial<NotFoundError> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The props can contain not only data
but also any value of type NotFoundError
.
Since the global not found
case passes undefined
, we use Partial
to account for the possibility that required fields might be added to NotFoundError
in the future.
@schiller-manuel Is there anything else I should do to get a review on this? |
thanks for this PR!
|
28b5de3
to
a3bdffd
Compare
…s data Signed-off-by: leesb971204 <[email protected]>
…nent Signed-off-by: leesb971204 <[email protected]>
@@ -240,7 +240,7 @@ export const Route = createFileRoute('/posts/$postId')({ | |||
}) | |||
return { post } | |||
}, | |||
// `data: unknown` is passed to the component via the `data` option when calling `notFound` | |||
// `data: any` is passed to the component via the `data` option when calling `notFound` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this any
instead of unknown
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because the type of notFoundRouteProps
was changed from unknown
to Partial<NotFoundError>
,
and the data
in NotFoundError
is currently typed as any
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we change it there to unknown? to force people to add some runtime type checks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you mean it should be reverted the change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I menthioned here, notFoundRouteProps
can contain not only data
but also any value of type NotFoundError
like routeId
.
or is it appropriate to convert the data
type of NotFoundError
to unknown
?
fixes #4744