fix(router-core): Prevents the app from crashing when a primitive value is thrown in beforeLoad#4724
Closed
leesb971204 wants to merge 5 commits into
Closed
Conversation
Signed-off-by: leesb971204 <leesb971204@gmail.com>
Signed-off-by: leesb971204 <leesb971204@gmail.com>
Contributor
|
View your CI Pipeline Execution ↗ for commit b63d947
☁️ 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 <leesb971204@gmail.com>
leesb971204
commented
Jul 20, 2025
| throw err | ||
| } | ||
|
|
||
| err.routerCode = routerCode |
Contributor
Author
There was a problem hiding this comment.
The app crashes at this point when err is a primitive type.
Comment on lines
-2195
to
+2196
| route.options.onError?.(err) | ||
| route.options.onError?.(err, routerCode) |
Contributor
Author
There was a problem hiding this comment.
Applies minimal changes to preserve compatibility for users accessing err.routerCode in onError.
In fact, there are quite a few people who use it this way.
Comment on lines
-3075
to
+3076
| this._handleNotFound(matches, err, { | ||
| this._handleNotFound(matches, err, routerCode, { |
Contributor
Author
There was a problem hiding this comment.
Passes routerCode separately alongside err.
…e type error Signed-off-by: leesb971204 <leesb971204@gmail.com>
…ode parameter Signed-off-by: leesb971204 <leesb971204@gmail.com>
leesb971204
commented
Jul 21, 2025
Comment on lines
+2197
to
+2200
| handleRedirectAndNotFound( | ||
| this.getMatch(matchId)!, | ||
| err, | ||
| routerCode, |
Contributor
Author
There was a problem hiding this comment.
Passes the routerCode, which was previously included in err, as a separate parameter to _handleNotFound.
Collaborator
|
closed in favor of #7505 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #4707, #4708