@tanstack/react-router 1.4.7 → 1.4.8
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/build/cjs/router.js +2 -2
- package/build/cjs/router.js.map +1 -1
- package/build/cjs/utils.js +9 -3
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/index.js +11 -5
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +355 -355
- package/build/umd/index.development.js +11 -5
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/router.ts +4 -4
- package/src/utils.ts +14 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-router",
|
|
3
3
|
"author": "Tanner Linsley",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.8",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "tanstack/router",
|
|
7
7
|
"homepage": "https://tanstack.com/router",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@tanstack/store": "^0.1.3",
|
|
45
45
|
"tiny-invariant": "^1.3.1",
|
|
46
46
|
"tiny-warning": "^1.0.3",
|
|
47
|
-
"@tanstack/history": "1.4.
|
|
47
|
+
"@tanstack/history": "1.4.8"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "rollup --config rollup.config.js"
|
package/src/router.ts
CHANGED
|
@@ -1060,9 +1060,9 @@ export class Router<
|
|
|
1060
1060
|
|
|
1061
1061
|
const pendingMs =
|
|
1062
1062
|
route.options.pendingMs ?? this.options.defaultPendingMs
|
|
1063
|
-
const pendingPromise =
|
|
1064
|
-
|
|
1065
|
-
|
|
1063
|
+
const pendingPromise = typeof pendingMs === 'number' && pendingMs <= 0
|
|
1064
|
+
? Promise.resolve()
|
|
1065
|
+
: new Promise<void>((r) => setTimeout(r, pendingMs))
|
|
1066
1066
|
|
|
1067
1067
|
const beforeLoadContext =
|
|
1068
1068
|
(await route.options.beforeLoad?.({
|
|
@@ -1145,7 +1145,7 @@ export class Router<
|
|
|
1145
1145
|
route.options.pendingMinMs ?? this.options.defaultPendingMinMs
|
|
1146
1146
|
const shouldPending =
|
|
1147
1147
|
!preload &&
|
|
1148
|
-
pendingMs &&
|
|
1148
|
+
typeof pendingMs === 'number' &&
|
|
1149
1149
|
(route.options.pendingComponent ??
|
|
1150
1150
|
this.options.defaultPendingComponent)
|
|
1151
1151
|
|
package/src/utils.ts
CHANGED
|
@@ -156,7 +156,8 @@ export function replaceEqualDeep<T>(prev: any, _next: T): T {
|
|
|
156
156
|
const array = isPlainArray(prev) && isPlainArray(next)
|
|
157
157
|
|
|
158
158
|
if (array || (isPlainObject(prev) && isPlainObject(next))) {
|
|
159
|
-
const
|
|
159
|
+
const prevItems = array ? prev : Object.keys(prev)
|
|
160
|
+
const prevSize = prevItems.length
|
|
160
161
|
const nextItems = array ? next : Object.keys(next)
|
|
161
162
|
const nextSize = nextItems.length
|
|
162
163
|
const copy: any = array ? [] : {}
|
|
@@ -165,9 +166,19 @@ export function replaceEqualDeep<T>(prev: any, _next: T): T {
|
|
|
165
166
|
|
|
166
167
|
for (let i = 0; i < nextSize; i++) {
|
|
167
168
|
const key = array ? i : nextItems[i]
|
|
168
|
-
|
|
169
|
-
|
|
169
|
+
if (
|
|
170
|
+
!array &&
|
|
171
|
+
prev[key] === undefined &&
|
|
172
|
+
next[key] === undefined &&
|
|
173
|
+
prevItems.includes(key)
|
|
174
|
+
) {
|
|
175
|
+
copy[key] = undefined
|
|
170
176
|
equalItems++
|
|
177
|
+
} else {
|
|
178
|
+
copy[key] = replaceEqualDeep(prev[key], next[key])
|
|
179
|
+
if (copy[key] === prev[key] && prev[key] !== undefined) {
|
|
180
|
+
equalItems++
|
|
181
|
+
}
|
|
171
182
|
}
|
|
172
183
|
}
|
|
173
184
|
|