Skip to content
Source
Sign inSign up
TanStack/router

fix: handle notFound from params.parse correctly #5864

Mergedjoseph0926(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/5864/headmerged by birkskyum(GitHub profile, opens in a new tab)

Showing 2 changed files with 68 additions and 4 deletions.

x
0 of 2 viewed, 2 left
8 additions and 4 deletionspackages/router-core/src/router.tsModified
View file
@@ -1379,7 +1379,7 @@
const strictParams = existingMatch?._strictParams ?? usedParams
- let paramsError: PathParamError | undefined = undefined
+ let paramsError: unknown = undefined
if (!existingMatch) {
const strictParseParams =
@@ -1392,9 +1392,13 @@
strictParseParams(strictParams as Record<string, string>),
} catch (err: any) {
- paramsError = new PathParamError(err.message, {
- cause: err,
- })
+ if (isNotFound(err) || isRedirect(err)) {
+ paramsError = err
+ } else {
+ paramsError = new PathParamError(err.message, {
+ cause: err,
+ })
+ }
if (opts?.throwOnError) {