@tanstack/react-router 0.0.1-beta.182 → 0.0.1-beta.184
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/react.js +5 -14
- package/build/cjs/react.js.map +1 -1
- package/build/esm/index.js +5 -14
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +98 -98
- package/build/umd/index.development.js +28 -38
- 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/react.tsx +8 -21
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.184",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "tanstack/router",
|
|
7
7
|
"homepage": "https://tanstack.com/router",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"tiny-warning": "^1.0.3",
|
|
45
45
|
"@tanstack/react-store": "^0.0.1",
|
|
46
46
|
"@gisatcz/cross-package-react-context": "^0.2.0",
|
|
47
|
-
"@tanstack/router-core": "0.0.1-beta.
|
|
47
|
+
"@tanstack/router-core": "0.0.1-beta.184"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "rollup --config rollup.config.js"
|
package/src/react.tsx
CHANGED
|
@@ -600,16 +600,7 @@ function Matches() {
|
|
|
600
600
|
|
|
601
601
|
const matchIds = useRouterState({
|
|
602
602
|
select: (state) => {
|
|
603
|
-
|
|
604
|
-
const route = router.getRoute(d.routeId as any)
|
|
605
|
-
return !!route?.options.pendingComponent
|
|
606
|
-
})
|
|
607
|
-
|
|
608
|
-
if (hasPendingComponent) {
|
|
609
|
-
return state.pendingMatchIds
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
return state.matchIds
|
|
603
|
+
return state.renderedMatchIds
|
|
613
604
|
},
|
|
614
605
|
})
|
|
615
606
|
|
|
@@ -644,8 +635,8 @@ export function useMatches<T = RouteMatch[]>(opts?: {
|
|
|
644
635
|
|
|
645
636
|
return useRouterState({
|
|
646
637
|
select: (state) => {
|
|
647
|
-
const matches = state.
|
|
648
|
-
state.
|
|
638
|
+
const matches = state.renderedMatches.slice(
|
|
639
|
+
state.renderedMatches.findIndex((d) => d.id === matchIds[0]),
|
|
649
640
|
)
|
|
650
641
|
return opts?.select ? opts.select(matches) : (matches as T)
|
|
651
642
|
},
|
|
@@ -681,11 +672,9 @@ export function useMatch<
|
|
|
681
672
|
|
|
682
673
|
const matchRouteId = useRouterState({
|
|
683
674
|
select: (state) => {
|
|
684
|
-
const matches =
|
|
685
|
-
state.status === 'pending' ? state.pendingMatches : state.matches
|
|
686
675
|
const match = opts?.from
|
|
687
|
-
?
|
|
688
|
-
:
|
|
676
|
+
? state.renderedMatches.find((d) => d.routeId === opts?.from)
|
|
677
|
+
: state.renderedMatches.find((d) => d.id === nearestMatchId)
|
|
689
678
|
|
|
690
679
|
return match!.routeId
|
|
691
680
|
},
|
|
@@ -706,11 +695,9 @@ export function useMatch<
|
|
|
706
695
|
|
|
707
696
|
const matchSelection = useRouterState({
|
|
708
697
|
select: (state) => {
|
|
709
|
-
const matches =
|
|
710
|
-
state.status === 'pending' ? state.pendingMatches : state.matches
|
|
711
698
|
const match = opts?.from
|
|
712
|
-
?
|
|
713
|
-
:
|
|
699
|
+
? state.renderedMatches.find((d) => d.routeId === opts?.from)
|
|
700
|
+
: state.renderedMatches.find((d) => d.id === nearestMatchId)
|
|
714
701
|
|
|
715
702
|
invariant(
|
|
716
703
|
match,
|
|
@@ -832,7 +819,7 @@ export function useParams<
|
|
|
832
819
|
): TSelected {
|
|
833
820
|
return useRouterState({
|
|
834
821
|
select: (state: any) => {
|
|
835
|
-
const params = (last(state.
|
|
822
|
+
const params = (last(state.renderedMatches) as any)?.params
|
|
836
823
|
return opts?.select ? opts.select(params) : params
|
|
837
824
|
},
|
|
838
825
|
})
|