@tanstack/react-router 1.25.1 → 1.26.1
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/dist/cjs/CatchBoundary.cjs +14 -7
- package/dist/cjs/CatchBoundary.cjs.map +1 -1
- package/dist/cjs/CatchBoundary.d.cts +0 -26
- package/dist/cjs/Matches.cjs +3 -3
- package/dist/cjs/Matches.cjs.map +1 -1
- package/dist/cjs/index.cjs +0 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +1 -1
- package/dist/cjs/link.cjs +10 -10
- package/dist/cjs/link.cjs.map +1 -1
- package/dist/cjs/link.d.cts +1 -1
- package/dist/cjs/route.cjs.map +1 -1
- package/dist/cjs/route.d.cts +4 -2
- package/dist/cjs/router.cjs +3 -2
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +3 -3
- package/dist/esm/CatchBoundary.d.ts +0 -26
- package/dist/esm/CatchBoundary.js +14 -7
- package/dist/esm/CatchBoundary.js.map +1 -1
- package/dist/esm/Matches.js +3 -3
- package/dist/esm/Matches.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -2
- package/dist/esm/link.d.ts +1 -1
- package/dist/esm/link.js +10 -10
- package/dist/esm/link.js.map +1 -1
- package/dist/esm/route.d.ts +4 -2
- package/dist/esm/route.js.map +1 -1
- package/dist/esm/router.d.ts +3 -3
- package/dist/esm/router.js +3 -2
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/CatchBoundary.tsx +17 -8
- package/src/Matches.tsx +3 -3
- package/src/index.tsx +1 -5
- package/src/link.tsx +15 -13
- package/src/route.ts +4 -2
- package/src/router.ts +5 -4
package/src/link.tsx
CHANGED
|
@@ -76,9 +76,11 @@ export type Last<T extends Array<any>> = T extends [...infer _, infer L]
|
|
|
76
76
|
? L
|
|
77
77
|
: never
|
|
78
78
|
|
|
79
|
-
export type RemoveTrailingSlashes<T> = T extends
|
|
80
|
-
?
|
|
81
|
-
: T
|
|
79
|
+
export type RemoveTrailingSlashes<T> = T extends '/'
|
|
80
|
+
? T
|
|
81
|
+
: T extends `${infer R}/`
|
|
82
|
+
? RemoveTrailingSlashes<R>
|
|
83
|
+
: T
|
|
82
84
|
|
|
83
85
|
export type RemoveLeadingSlashes<T> = T extends `/${infer R}`
|
|
84
86
|
? RemoveLeadingSlashes<R>
|
|
@@ -455,16 +457,16 @@ export function useLinkProps<
|
|
|
455
457
|
...rest,
|
|
456
458
|
type,
|
|
457
459
|
href: to,
|
|
458
|
-
children,
|
|
459
|
-
target,
|
|
460
|
-
disabled,
|
|
461
|
-
style,
|
|
462
|
-
className,
|
|
463
|
-
onClick,
|
|
464
|
-
onFocus,
|
|
465
|
-
onMouseEnter,
|
|
466
|
-
onMouseLeave,
|
|
467
|
-
onTouchStart,
|
|
460
|
+
...(children && { children }),
|
|
461
|
+
...(target && { target }),
|
|
462
|
+
...(disabled && { disabled }),
|
|
463
|
+
...(style && { style }),
|
|
464
|
+
...(className && { className }),
|
|
465
|
+
...(onClick && { onClick }),
|
|
466
|
+
...(onFocus && { onFocus }),
|
|
467
|
+
...(onMouseEnter && { onMouseEnter }),
|
|
468
|
+
...(onMouseLeave && { onMouseLeave }),
|
|
469
|
+
...(onTouchStart && { onTouchStart }),
|
|
468
470
|
}
|
|
469
471
|
}
|
|
470
472
|
|
package/src/route.ts
CHANGED
|
@@ -1256,12 +1256,14 @@ export function createRouteMask<
|
|
|
1256
1256
|
*/
|
|
1257
1257
|
export type ErrorRouteProps = {
|
|
1258
1258
|
error: unknown
|
|
1259
|
-
info
|
|
1259
|
+
info?: { componentStack: string }
|
|
1260
|
+
reset: () => void
|
|
1260
1261
|
}
|
|
1261
1262
|
|
|
1262
1263
|
export type ErrorComponentProps = {
|
|
1263
1264
|
error: unknown
|
|
1264
|
-
info
|
|
1265
|
+
info?: { componentStack: string }
|
|
1266
|
+
reset: () => void
|
|
1265
1267
|
}
|
|
1266
1268
|
export type NotFoundRouteProps = {
|
|
1267
1269
|
// TODO: Make sure this is `| null | undefined` (this is for global not-founds)
|
package/src/router.ts
CHANGED
|
@@ -40,9 +40,9 @@ import type {
|
|
|
40
40
|
AnyContext,
|
|
41
41
|
AnyRoute,
|
|
42
42
|
AnySearchSchema,
|
|
43
|
+
ErrorRouteComponent,
|
|
43
44
|
LoaderFnContext,
|
|
44
45
|
NotFoundRouteComponent,
|
|
45
|
-
Route,
|
|
46
46
|
RouteMask,
|
|
47
47
|
} from './route'
|
|
48
48
|
import type {
|
|
@@ -122,7 +122,7 @@ export interface RouterOptions<
|
|
|
122
122
|
defaultPreload?: false | 'intent'
|
|
123
123
|
defaultPreloadDelay?: number
|
|
124
124
|
defaultComponent?: RouteComponent
|
|
125
|
-
defaultErrorComponent?:
|
|
125
|
+
defaultErrorComponent?: ErrorRouteComponent
|
|
126
126
|
defaultPendingComponent?: RouteComponent
|
|
127
127
|
defaultPendingMs?: number
|
|
128
128
|
defaultPendingMinMs?: number
|
|
@@ -1545,9 +1545,10 @@ export class Router<
|
|
|
1545
1545
|
}
|
|
1546
1546
|
|
|
1547
1547
|
invalidate = () => {
|
|
1548
|
-
const invalidate = (d:
|
|
1548
|
+
const invalidate = (d: RouteMatch<TRouteTree>) => ({
|
|
1549
1549
|
...d,
|
|
1550
1550
|
invalid: true,
|
|
1551
|
+
...(d.status === 'error' ? ({ status: 'pending' } as const) : {}),
|
|
1551
1552
|
})
|
|
1552
1553
|
|
|
1553
1554
|
this.__store.setState((s) => ({
|
|
@@ -1557,7 +1558,7 @@ export class Router<
|
|
|
1557
1558
|
pendingMatches: s.pendingMatches?.map(invalidate),
|
|
1558
1559
|
}))
|
|
1559
1560
|
|
|
1560
|
-
this.load()
|
|
1561
|
+
return this.load()
|
|
1561
1562
|
}
|
|
1562
1563
|
|
|
1563
1564
|
load = async (): Promise<void> => {
|