@tanstack/react-router 0.0.1-beta.277 → 0.0.1-beta.278
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 +7 -3
- package/build/cjs/Matches.js.map +1 -1
- package/build/cjs/router.js +2 -2
- package/build/cjs/router.js.map +1 -1
- package/build/esm/index.js +9 -5
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +353 -353
- package/build/umd/index.development.js +9 -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/Matches.tsx +6 -3
- package/src/router.ts +2 -2
|
@@ -942,13 +942,14 @@
|
|
|
942
942
|
invariant(routeId, `Could not find routeId for matchId "${matchId}". Please file an issue!`);
|
|
943
943
|
const route = router.routesById[routeId];
|
|
944
944
|
const PendingComponent = route.options.pendingComponent ?? router.options.defaultPendingComponent;
|
|
945
|
+
const pendingElement = PendingComponent ? /*#__PURE__*/React__namespace.createElement(PendingComponent, null) : null;
|
|
945
946
|
const routeErrorComponent = route.options.errorComponent ?? router.options.defaultErrorComponent ?? ErrorComponent;
|
|
946
947
|
const ResolvedSuspenseBoundary = route.options.wrapInSuspense ?? PendingComponent ?? route.options.component?.preload ?? route.options.pendingComponent?.preload ?? route.options.errorComponent?.preload ? React__namespace.Suspense : SafeFragment;
|
|
947
948
|
const ResolvedCatchBoundary = routeErrorComponent ? CatchBoundary : SafeFragment;
|
|
948
949
|
return /*#__PURE__*/React__namespace.createElement(matchContext.Provider, {
|
|
949
950
|
value: matchId
|
|
950
951
|
}, /*#__PURE__*/React__namespace.createElement(ResolvedSuspenseBoundary, {
|
|
951
|
-
fallback:
|
|
952
|
+
fallback: pendingElement
|
|
952
953
|
}, /*#__PURE__*/React__namespace.createElement(ResolvedCatchBoundary, {
|
|
953
954
|
getResetKey: () => router.state.resolvedLocation.state?.key,
|
|
954
955
|
errorComponent: routeErrorComponent,
|
|
@@ -957,7 +958,7 @@
|
|
|
957
958
|
}
|
|
958
959
|
}, /*#__PURE__*/React__namespace.createElement(MatchInner, {
|
|
959
960
|
matchId: matchId,
|
|
960
|
-
pendingElement:
|
|
961
|
+
pendingElement: pendingElement
|
|
961
962
|
}))));
|
|
962
963
|
}
|
|
963
964
|
function MatchInner({
|
|
@@ -977,7 +978,7 @@
|
|
|
977
978
|
}
|
|
978
979
|
if (match.status === 'pending') {
|
|
979
980
|
if (match.showPending) {
|
|
980
|
-
return pendingElement
|
|
981
|
+
return pendingElement;
|
|
981
982
|
}
|
|
982
983
|
throw match.loadPromise;
|
|
983
984
|
}
|
|
@@ -1007,6 +1008,9 @@
|
|
|
1007
1008
|
});
|
|
1008
1009
|
});
|
|
1009
1010
|
function useMatchRoute() {
|
|
1011
|
+
useRouterState({
|
|
1012
|
+
select: s => [s.location, s.resolvedLocation]
|
|
1013
|
+
});
|
|
1010
1014
|
const {
|
|
1011
1015
|
matchRoute
|
|
1012
1016
|
} = useRouter();
|
|
@@ -2538,9 +2542,9 @@
|
|
|
2538
2542
|
let latestPromise;
|
|
2539
2543
|
let firstBadMatchIndex;
|
|
2540
2544
|
const updateMatch = match => {
|
|
2541
|
-
const isPreload = this.state.preloadMatches.find(d => d.id === match.id)
|
|
2545
|
+
// const isPreload = this.state.preloadMatches.find((d) => d.id === match.id)
|
|
2542
2546
|
const isPending = this.state.pendingMatches?.find(d => d.id === match.id);
|
|
2543
|
-
const matchesKey =
|
|
2547
|
+
const matchesKey = preload ? 'preloadMatches' : isPending ? 'pendingMatches' : 'matches';
|
|
2544
2548
|
this.__store.setState(s => ({
|
|
2545
2549
|
...s,
|
|
2546
2550
|
[matchesKey]: s[matchesKey]?.map(d => d.id === match.id ? match : d)
|