@tanstack/react-router 1.131.2 → 1.131.4
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/Match.cjs +30 -29
- package/dist/cjs/Match.cjs.map +1 -1
- package/dist/cjs/typePrimitives.d.cts +0 -6
- package/dist/esm/Match.js +31 -30
- package/dist/esm/Match.js.map +1 -1
- package/dist/esm/typePrimitives.d.ts +0 -6
- package/dist/llms/rules/api.d.ts +1 -1
- package/dist/llms/rules/api.js +0 -1
- package/package.json +2 -2
- package/src/Match.tsx +32 -34
package/dist/llms/rules/api.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-router",
|
|
3
|
-
"version": "1.131.
|
|
3
|
+
"version": "1.131.4",
|
|
4
4
|
"description": "Modern and scalable routing for React applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"tiny-invariant": "^1.3.3",
|
|
81
81
|
"tiny-warning": "^1.0.3",
|
|
82
82
|
"@tanstack/history": "1.131.2",
|
|
83
|
-
"@tanstack/router-core": "1.131.
|
|
83
|
+
"@tanstack/router-core": "1.131.4"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@testing-library/jest-dom": "^6.6.3",
|
package/src/Match.tsx
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
getLocationChangeInfo,
|
|
7
7
|
isNotFound,
|
|
8
8
|
isRedirect,
|
|
9
|
-
pick,
|
|
10
9
|
rootRouteId,
|
|
11
10
|
} from '@tanstack/router-core'
|
|
12
11
|
import { CatchBoundary, ErrorComponent } from './CatchBoundary'
|
|
@@ -37,7 +36,11 @@ export const Match = React.memo(function MatchImpl({
|
|
|
37
36
|
match,
|
|
38
37
|
`Could not find match for matchId "${matchId}". Please file an issue!`,
|
|
39
38
|
)
|
|
40
|
-
return
|
|
39
|
+
return {
|
|
40
|
+
routeId: match.routeId,
|
|
41
|
+
ssr: match.ssr,
|
|
42
|
+
_displayPending: match._displayPending,
|
|
43
|
+
}
|
|
41
44
|
},
|
|
42
45
|
structuralSharing: true as any,
|
|
43
46
|
})
|
|
@@ -204,13 +207,13 @@ export const MatchInner = React.memo(function MatchInnerImpl({
|
|
|
204
207
|
return {
|
|
205
208
|
key,
|
|
206
209
|
routeId,
|
|
207
|
-
match:
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
210
|
+
match: {
|
|
211
|
+
id: match.id,
|
|
212
|
+
status: match.status,
|
|
213
|
+
error: match.error,
|
|
214
|
+
_forcePending: match._forcePending,
|
|
215
|
+
_displayPending: match._displayPending,
|
|
216
|
+
},
|
|
214
217
|
}
|
|
215
218
|
},
|
|
216
219
|
structuralSharing: true as any,
|
|
@@ -227,11 +230,11 @@ export const MatchInner = React.memo(function MatchInnerImpl({
|
|
|
227
230
|
}, [key, route.options.component, router.options.defaultComponent])
|
|
228
231
|
|
|
229
232
|
if (match._displayPending) {
|
|
230
|
-
throw router.getMatch(match.id)?.displayPendingPromise
|
|
233
|
+
throw router.getMatch(match.id)?._nonReactive.displayPendingPromise
|
|
231
234
|
}
|
|
232
235
|
|
|
233
236
|
if (match._forcePending) {
|
|
234
|
-
throw router.getMatch(match.id)?.minPendingPromise
|
|
237
|
+
throw router.getMatch(match.id)?._nonReactive.minPendingPromise
|
|
235
238
|
}
|
|
236
239
|
|
|
237
240
|
// see also hydrate() in packages/router-core/src/ssr/ssr-client.ts
|
|
@@ -239,31 +242,26 @@ export const MatchInner = React.memo(function MatchInnerImpl({
|
|
|
239
242
|
// We're pending, and if we have a minPendingMs, we need to wait for it
|
|
240
243
|
const pendingMinMs =
|
|
241
244
|
route.options.pendingMinMs ?? router.options.defaultPendingMinMs
|
|
245
|
+
if (pendingMinMs) {
|
|
246
|
+
const routerMatch = router.getMatch(match.id)
|
|
247
|
+
if (routerMatch && !routerMatch._nonReactive.minPendingPromise) {
|
|
248
|
+
// Create a promise that will resolve after the minPendingMs
|
|
249
|
+
if (!router.isServer) {
|
|
250
|
+
const minPendingPromise = createControlledPromise<void>()
|
|
251
|
+
|
|
252
|
+
Promise.resolve().then(() => {
|
|
253
|
+
routerMatch._nonReactive.minPendingPromise = minPendingPromise
|
|
254
|
+
})
|
|
242
255
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
router.updateMatch(match.id, (prev) => ({
|
|
250
|
-
...prev,
|
|
251
|
-
minPendingPromise,
|
|
252
|
-
}))
|
|
253
|
-
})
|
|
254
|
-
|
|
255
|
-
setTimeout(() => {
|
|
256
|
-
minPendingPromise.resolve()
|
|
257
|
-
|
|
258
|
-
// We've handled the minPendingPromise, so we can delete it
|
|
259
|
-
router.updateMatch(match.id, (prev) => ({
|
|
260
|
-
...prev,
|
|
261
|
-
minPendingPromise: undefined,
|
|
262
|
-
}))
|
|
263
|
-
}, pendingMinMs)
|
|
256
|
+
setTimeout(() => {
|
|
257
|
+
minPendingPromise.resolve()
|
|
258
|
+
// We've handled the minPendingPromise, so we can delete it
|
|
259
|
+
routerMatch._nonReactive.minPendingPromise = undefined
|
|
260
|
+
}, pendingMinMs)
|
|
261
|
+
}
|
|
264
262
|
}
|
|
265
263
|
}
|
|
266
|
-
throw router.getMatch(match.id)?.loadPromise
|
|
264
|
+
throw router.getMatch(match.id)?._nonReactive.loadPromise
|
|
267
265
|
}
|
|
268
266
|
|
|
269
267
|
if (match.status === 'notFound') {
|
|
@@ -280,7 +278,7 @@ export const MatchInner = React.memo(function MatchInnerImpl({
|
|
|
280
278
|
// false,
|
|
281
279
|
// 'Tried to render a redirected route match! This is a weird circumstance, please file an issue!',
|
|
282
280
|
// )
|
|
283
|
-
throw router.getMatch(match.id)?.loadPromise
|
|
281
|
+
throw router.getMatch(match.id)?._nonReactive.loadPromise
|
|
284
282
|
}
|
|
285
283
|
|
|
286
284
|
if (match.status === 'error') {
|