@tanstack/react-router 1.4.4 → 1.4.6
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/Matches.js +5 -1
- package/build/cjs/Matches.js.map +1 -1
- package/build/cjs/router.js +5 -2
- package/build/cjs/router.js.map +1 -1
- package/build/esm/index.js +10 -3
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +355 -355
- package/build/types/Matches.d.ts +1 -0
- package/build/umd/index.development.js +10 -3
- 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/Matches.tsx +4 -1
- package/src/router.ts +8 -1
package/build/types/Matches.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export interface RouteMatch<TRouteTree extends AnyRoute = AnyRoute, TRouteId ext
|
|
|
28
28
|
loaderDeps: RouteById<TRouteTree, TRouteId>['types']['loaderDeps'];
|
|
29
29
|
preload: boolean;
|
|
30
30
|
invalid: boolean;
|
|
31
|
+
pendingPromise?: Promise<void>;
|
|
31
32
|
}
|
|
32
33
|
export type AnyRouteMatch = RouteMatch<any, any>;
|
|
33
34
|
export declare function Matches(): React.JSX.Element;
|
|
@@ -1024,11 +1024,15 @@
|
|
|
1024
1024
|
const {
|
|
1025
1025
|
pending,
|
|
1026
1026
|
caseSensitive,
|
|
1027
|
+
fuzzy,
|
|
1028
|
+
includeSearch,
|
|
1027
1029
|
...rest
|
|
1028
1030
|
} = opts;
|
|
1029
1031
|
return matchRoute(rest, {
|
|
1030
1032
|
pending,
|
|
1031
|
-
caseSensitive
|
|
1033
|
+
caseSensitive,
|
|
1034
|
+
fuzzy,
|
|
1035
|
+
includeSearch
|
|
1032
1036
|
});
|
|
1033
1037
|
}, []);
|
|
1034
1038
|
}
|
|
@@ -2708,6 +2712,8 @@
|
|
|
2708
2712
|
handleErrorAndRedirect(match.searchError, 'VALIDATE_SEARCH');
|
|
2709
2713
|
}
|
|
2710
2714
|
const parentContext = parentMatch?.context ?? this.options.context ?? {};
|
|
2715
|
+
const pendingMs = route.options.pendingMs ?? this.options.defaultPendingMs;
|
|
2716
|
+
const pendingPromise = new Promise(r => setTimeout(r, pendingMs));
|
|
2711
2717
|
const beforeLoadContext = (await route.options.beforeLoad?.({
|
|
2712
2718
|
search: match.search,
|
|
2713
2719
|
abortController,
|
|
@@ -2734,7 +2740,8 @@
|
|
|
2734
2740
|
...match,
|
|
2735
2741
|
routeContext: replaceEqualDeep(match.routeContext, beforeLoadContext),
|
|
2736
2742
|
context: replaceEqualDeep(match.context, context),
|
|
2737
|
-
abortController
|
|
2743
|
+
abortController,
|
|
2744
|
+
pendingPromise
|
|
2738
2745
|
};
|
|
2739
2746
|
} catch (err) {
|
|
2740
2747
|
handleErrorAndRedirect(err, 'BEFORE_LOAD');
|
|
@@ -2875,7 +2882,7 @@
|
|
|
2875
2882
|
// If we need to potentially show the pending component,
|
|
2876
2883
|
// start a timer to show it after the pendingMs
|
|
2877
2884
|
if (shouldPending) {
|
|
2878
|
-
|
|
2885
|
+
match.pendingPromise?.then(async () => {
|
|
2879
2886
|
if (latestPromise = checkLatest()) return latestPromise;
|
|
2880
2887
|
didShowPending = true;
|
|
2881
2888
|
matches[index] = match = {
|