@tanstack/router-core 1.136.13 → 1.136.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/route.ts CHANGED
@@ -14,7 +14,7 @@ import type {
14
14
  RouteMatch,
15
15
  } from './Matches'
16
16
  import type { RootRouteId } from './root'
17
- import type { ParseRoute, RouteById, RoutePaths } from './routeInfo'
17
+ import type { ParseRoute, RouteById, RouteIds, RoutePaths } from './routeInfo'
18
18
  import type { AnyRouter, Register, RegisteredRouter, SSROption } from './router'
19
19
  import type { BuildLocationFn, NavigateFn } from './RouterProvider'
20
20
  import type {
@@ -1488,9 +1488,11 @@ export type ErrorComponentProps<TError = Error> = {
1488
1488
  info?: { componentStack: string }
1489
1489
  reset: () => void
1490
1490
  }
1491
+
1491
1492
  export type NotFoundRouteProps = {
1492
- // TODO: Make sure this is `| null | undefined` (this is for global not-founds)
1493
- data: unknown
1493
+ data?: unknown
1494
+ isNotFound: boolean
1495
+ routeId: RouteIds<RegisteredRouter['routeTree']>
1494
1496
  }
1495
1497
 
1496
1498
  export class BaseRoute<
package/src/router.ts CHANGED
@@ -1388,7 +1388,7 @@ export class RouterCore<
1388
1388
 
1389
1389
  const strictParams = existingMatch?._strictParams ?? usedParams
1390
1390
 
1391
- let paramsError: PathParamError | undefined = undefined
1391
+ let paramsError: unknown = undefined
1392
1392
 
1393
1393
  if (!existingMatch) {
1394
1394
  const strictParseParams =
@@ -1401,9 +1401,13 @@ export class RouterCore<
1401
1401
  strictParseParams(strictParams as Record<string, string>),
1402
1402
  )
1403
1403
  } catch (err: any) {
1404
- paramsError = new PathParamError(err.message, {
1405
- cause: err,
1406
- })
1404
+ if (isNotFound(err) || isRedirect(err)) {
1405
+ paramsError = err
1406
+ } else {
1407
+ paramsError = new PathParamError(err.message, {
1408
+ cause: err,
1409
+ })
1410
+ }
1407
1411
 
1408
1412
  if (opts?.throwOnError) {
1409
1413
  throw paramsError