@tanstack/react-router 1.131.3 → 1.131.5
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 +31 -31
- package/dist/cjs/Match.cjs.map +1 -1
- package/dist/esm/Match.js +32 -32
- package/dist/esm/Match.js.map +1 -1
- 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 +33 -36
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.5",
|
|
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.5"
|
|
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
|
})
|
|
@@ -186,8 +189,7 @@ export const MatchInner = React.memo(function MatchInnerImpl({
|
|
|
186
189
|
|
|
187
190
|
const { match, key, routeId } = useRouterState({
|
|
188
191
|
select: (s) => {
|
|
189
|
-
const
|
|
190
|
-
const match = s.matches[matchIndex]!
|
|
192
|
+
const match = s.matches.find((d) => d.id === matchId)!
|
|
191
193
|
const routeId = match.routeId as string
|
|
192
194
|
|
|
193
195
|
const remountFn =
|
|
@@ -204,13 +206,13 @@ export const MatchInner = React.memo(function MatchInnerImpl({
|
|
|
204
206
|
return {
|
|
205
207
|
key,
|
|
206
208
|
routeId,
|
|
207
|
-
match:
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
209
|
+
match: {
|
|
210
|
+
id: match.id,
|
|
211
|
+
status: match.status,
|
|
212
|
+
error: match.error,
|
|
213
|
+
_forcePending: match._forcePending,
|
|
214
|
+
_displayPending: match._displayPending,
|
|
215
|
+
},
|
|
214
216
|
}
|
|
215
217
|
},
|
|
216
218
|
structuralSharing: true as any,
|
|
@@ -227,11 +229,11 @@ export const MatchInner = React.memo(function MatchInnerImpl({
|
|
|
227
229
|
}, [key, route.options.component, router.options.defaultComponent])
|
|
228
230
|
|
|
229
231
|
if (match._displayPending) {
|
|
230
|
-
throw router.getMatch(match.id)?.displayPendingPromise
|
|
232
|
+
throw router.getMatch(match.id)?._nonReactive.displayPendingPromise
|
|
231
233
|
}
|
|
232
234
|
|
|
233
235
|
if (match._forcePending) {
|
|
234
|
-
throw router.getMatch(match.id)?.minPendingPromise
|
|
236
|
+
throw router.getMatch(match.id)?._nonReactive.minPendingPromise
|
|
235
237
|
}
|
|
236
238
|
|
|
237
239
|
// see also hydrate() in packages/router-core/src/ssr/ssr-client.ts
|
|
@@ -239,31 +241,26 @@ export const MatchInner = React.memo(function MatchInnerImpl({
|
|
|
239
241
|
// We're pending, and if we have a minPendingMs, we need to wait for it
|
|
240
242
|
const pendingMinMs =
|
|
241
243
|
route.options.pendingMinMs ?? router.options.defaultPendingMinMs
|
|
244
|
+
if (pendingMinMs) {
|
|
245
|
+
const routerMatch = router.getMatch(match.id)
|
|
246
|
+
if (routerMatch && !routerMatch._nonReactive.minPendingPromise) {
|
|
247
|
+
// Create a promise that will resolve after the minPendingMs
|
|
248
|
+
if (!router.isServer) {
|
|
249
|
+
const minPendingPromise = createControlledPromise<void>()
|
|
250
|
+
|
|
251
|
+
Promise.resolve().then(() => {
|
|
252
|
+
routerMatch._nonReactive.minPendingPromise = minPendingPromise
|
|
253
|
+
})
|
|
242
254
|
|
|
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)
|
|
255
|
+
setTimeout(() => {
|
|
256
|
+
minPendingPromise.resolve()
|
|
257
|
+
// We've handled the minPendingPromise, so we can delete it
|
|
258
|
+
routerMatch._nonReactive.minPendingPromise = undefined
|
|
259
|
+
}, pendingMinMs)
|
|
260
|
+
}
|
|
264
261
|
}
|
|
265
262
|
}
|
|
266
|
-
throw router.getMatch(match.id)?.loadPromise
|
|
263
|
+
throw router.getMatch(match.id)?._nonReactive.loadPromise
|
|
267
264
|
}
|
|
268
265
|
|
|
269
266
|
if (match.status === 'notFound') {
|
|
@@ -280,7 +277,7 @@ export const MatchInner = React.memo(function MatchInnerImpl({
|
|
|
280
277
|
// false,
|
|
281
278
|
// 'Tried to render a redirected route match! This is a weird circumstance, please file an issue!',
|
|
282
279
|
// )
|
|
283
|
-
throw router.getMatch(match.id)?.loadPromise
|
|
280
|
+
throw router.getMatch(match.id)?._nonReactive.loadPromise
|
|
284
281
|
}
|
|
285
282
|
|
|
286
283
|
if (match.status === 'error') {
|