@tanstack/react-router 1.4.6 → 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/build/esm/index.js
CHANGED
|
@@ -202,16 +202,22 @@ function replaceEqualDeep(prev, _next) {
|
|
|
202
202
|
const next = _next;
|
|
203
203
|
const array = isPlainArray(prev) && isPlainArray(next);
|
|
204
204
|
if (array || isPlainObject(prev) && isPlainObject(next)) {
|
|
205
|
-
const
|
|
205
|
+
const prevItems = array ? prev : Object.keys(prev);
|
|
206
|
+
const prevSize = prevItems.length;
|
|
206
207
|
const nextItems = array ? next : Object.keys(next);
|
|
207
208
|
const nextSize = nextItems.length;
|
|
208
209
|
const copy = array ? [] : {};
|
|
209
210
|
let equalItems = 0;
|
|
210
211
|
for (let i = 0; i < nextSize; i++) {
|
|
211
212
|
const key = array ? i : nextItems[i];
|
|
212
|
-
|
|
213
|
-
|
|
213
|
+
if (!array && prev[key] === undefined && next[key] === undefined && prevItems.includes(key)) {
|
|
214
|
+
copy[key] = undefined;
|
|
214
215
|
equalItems++;
|
|
216
|
+
} else {
|
|
217
|
+
copy[key] = replaceEqualDeep(prev[key], next[key]);
|
|
218
|
+
if (copy[key] === prev[key] && prev[key] !== undefined) {
|
|
219
|
+
equalItems++;
|
|
220
|
+
}
|
|
215
221
|
}
|
|
216
222
|
}
|
|
217
223
|
return prevSize === nextSize && equalItems === prevSize ? prev : copy;
|
|
@@ -2106,7 +2112,7 @@ class Router {
|
|
|
2106
2112
|
}
|
|
2107
2113
|
const parentContext = parentMatch?.context ?? this.options.context ?? {};
|
|
2108
2114
|
const pendingMs = route.options.pendingMs ?? this.options.defaultPendingMs;
|
|
2109
|
-
const pendingPromise = new Promise(r => setTimeout(r, pendingMs));
|
|
2115
|
+
const pendingPromise = typeof pendingMs === 'number' && pendingMs <= 0 ? Promise.resolve() : new Promise(r => setTimeout(r, pendingMs));
|
|
2110
2116
|
const beforeLoadContext = (await route.options.beforeLoad?.({
|
|
2111
2117
|
search: match.search,
|
|
2112
2118
|
abortController,
|
|
@@ -2171,7 +2177,7 @@ class Router {
|
|
|
2171
2177
|
let didShowPending = false;
|
|
2172
2178
|
const pendingMs = route.options.pendingMs ?? this.options.defaultPendingMs;
|
|
2173
2179
|
const pendingMinMs = route.options.pendingMinMs ?? this.options.defaultPendingMinMs;
|
|
2174
|
-
const shouldPending = !preload && pendingMs && (route.options.pendingComponent ?? this.options.defaultPendingComponent);
|
|
2180
|
+
const shouldPending = !preload && typeof pendingMs === 'number' && (route.options.pendingComponent ?? this.options.defaultPendingComponent);
|
|
2175
2181
|
const loaderContext = {
|
|
2176
2182
|
params: match.params,
|
|
2177
2183
|
deps: match.loaderDeps,
|