@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.
@@ -809,16 +809,22 @@
809
809
  const next = _next;
810
810
  const array = isPlainArray(prev) && isPlainArray(next);
811
811
  if (array || isPlainObject(prev) && isPlainObject(next)) {
812
- const prevSize = array ? prev.length : Object.keys(prev).length;
812
+ const prevItems = array ? prev : Object.keys(prev);
813
+ const prevSize = prevItems.length;
813
814
  const nextItems = array ? next : Object.keys(next);
814
815
  const nextSize = nextItems.length;
815
816
  const copy = array ? [] : {};
816
817
  let equalItems = 0;
817
818
  for (let i = 0; i < nextSize; i++) {
818
819
  const key = array ? i : nextItems[i];
819
- copy[key] = replaceEqualDeep(prev[key], next[key]);
820
- if (copy[key] === prev[key] && prev[key] !== undefined) {
820
+ if (!array && prev[key] === undefined && next[key] === undefined && prevItems.includes(key)) {
821
+ copy[key] = undefined;
821
822
  equalItems++;
823
+ } else {
824
+ copy[key] = replaceEqualDeep(prev[key], next[key]);
825
+ if (copy[key] === prev[key] && prev[key] !== undefined) {
826
+ equalItems++;
827
+ }
822
828
  }
823
829
  }
824
830
  return prevSize === nextSize && equalItems === prevSize ? prev : copy;
@@ -2713,7 +2719,7 @@
2713
2719
  }
2714
2720
  const parentContext = parentMatch?.context ?? this.options.context ?? {};
2715
2721
  const pendingMs = route.options.pendingMs ?? this.options.defaultPendingMs;
2716
- const pendingPromise = new Promise(r => setTimeout(r, pendingMs));
2722
+ const pendingPromise = typeof pendingMs === 'number' && pendingMs <= 0 ? Promise.resolve() : new Promise(r => setTimeout(r, pendingMs));
2717
2723
  const beforeLoadContext = (await route.options.beforeLoad?.({
2718
2724
  search: match.search,
2719
2725
  abortController,
@@ -2778,7 +2784,7 @@
2778
2784
  let didShowPending = false;
2779
2785
  const pendingMs = route.options.pendingMs ?? this.options.defaultPendingMs;
2780
2786
  const pendingMinMs = route.options.pendingMinMs ?? this.options.defaultPendingMinMs;
2781
- const shouldPending = !preload && pendingMs && (route.options.pendingComponent ?? this.options.defaultPendingComponent);
2787
+ const shouldPending = !preload && typeof pendingMs === 'number' && (route.options.pendingComponent ?? this.options.defaultPendingComponent);
2782
2788
  const loaderContext = {
2783
2789
  params: match.params,
2784
2790
  deps: match.loaderDeps,