@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/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.182",
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.182"
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
- const hasPendingComponent = state.pendingMatches.some((d) => {
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.matches.slice(
648
- state.matches.findIndex((d) => d.id === matchIds[0]),
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
- ? matches.find((d) => d.routeId === opts?.from)
688
- : matches.find((d) => d.id === nearestMatchId)
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
- ? matches.find((d) => d.routeId === opts?.from)
713
- : matches.find((d) => d.id === nearestMatchId)
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.matches) as any)?.params
822
+ const params = (last(state.renderedMatches) as any)?.params
836
823
  return opts?.select ? opts.select(params) : params
837
824
  },
838
825
  })