@tanstack/react-router 0.0.1-beta.35 → 0.0.1-beta.36
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/index.js +8 -8
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.js +8 -8
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +50 -50
- package/build/umd/index.development.js +103 -93
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +2 -2
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/index.tsx +10 -8
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-router",
|
|
3
3
|
"author": "Tanner Linsley",
|
|
4
|
-
"version": "0.0.1-beta.
|
|
4
|
+
"version": "0.0.1-beta.36",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "tanstack/router",
|
|
7
7
|
"homepage": "https://tanstack.com/router/",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@babel/runtime": "^7.16.7",
|
|
44
|
-
"@tanstack/router-core": "0.0.1-beta.
|
|
44
|
+
"@tanstack/router-core": "0.0.1-beta.36",
|
|
45
45
|
"use-sync-external-store": "^1.2.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
package/src/index.tsx
CHANGED
|
@@ -430,7 +430,9 @@ export function createReactRouter<
|
|
|
430
430
|
)
|
|
431
431
|
|
|
432
432
|
const nearestMatch = useNearestMatch()
|
|
433
|
-
const match = router.state.
|
|
433
|
+
const match = router.state.currentMatches.find(
|
|
434
|
+
(d) => d.routeId === routeId,
|
|
435
|
+
)
|
|
434
436
|
|
|
435
437
|
if (opts?.strict ?? true) {
|
|
436
438
|
invariant(
|
|
@@ -504,7 +506,7 @@ export function RouterProvider<
|
|
|
504
506
|
return (
|
|
505
507
|
<>
|
|
506
508
|
<routerContext.Provider value={{ router: router as any }}>
|
|
507
|
-
<MatchesProvider value={[undefined!, ...router.state.
|
|
509
|
+
<MatchesProvider value={[undefined!, ...router.state.currentMatches]}>
|
|
508
510
|
<Outlet />
|
|
509
511
|
</MatchesProvider>
|
|
510
512
|
</routerContext.Provider>
|
|
@@ -569,7 +571,7 @@ export function useRoute<
|
|
|
569
571
|
export function useSearch<
|
|
570
572
|
TId extends keyof RegisteredAllRouteInfo['routeInfoById'] = keyof RegisteredAllRouteInfo['routeInfoById'],
|
|
571
573
|
>(_routeId?: TId): RegisteredAllRouteInfo['fullSearchSchema'] {
|
|
572
|
-
return useRouter().state.
|
|
574
|
+
return useRouter().state.currentLocation.search
|
|
573
575
|
}
|
|
574
576
|
|
|
575
577
|
export function linkProps<TTo extends string = '.'>(
|
|
@@ -695,10 +697,10 @@ function CatchBoundaryInner(props: {
|
|
|
695
697
|
|
|
696
698
|
React.useEffect(() => {
|
|
697
699
|
if (activeErrorState) {
|
|
698
|
-
let prevKey = router.state.
|
|
700
|
+
let prevKey = router.state.currentLocation.key
|
|
699
701
|
return router.subscribe(() => {
|
|
700
|
-
if (router.state.
|
|
701
|
-
prevKey = router.state.
|
|
702
|
+
if (router.state.currentLocation.key !== prevKey) {
|
|
703
|
+
prevKey = router.state.currentLocation.key
|
|
702
704
|
setActiveErrorState({} as any)
|
|
703
705
|
}
|
|
704
706
|
})
|
|
@@ -758,12 +760,12 @@ export function usePrompt(message: string, when: boolean | any): void {
|
|
|
758
760
|
unblock()
|
|
759
761
|
transition.retry()
|
|
760
762
|
} else {
|
|
761
|
-
router.state.
|
|
763
|
+
router.state.currentLocation.pathname = window.location.pathname
|
|
762
764
|
}
|
|
763
765
|
})
|
|
764
766
|
|
|
765
767
|
return unblock
|
|
766
|
-
}, [when,
|
|
768
|
+
}, [when, message])
|
|
767
769
|
}
|
|
768
770
|
|
|
769
771
|
export function Prompt({ message, when, children }: PromptProps) {
|