@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/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.277",
4
+ "version": "0.0.1-beta.278",
5
5
  "license": "MIT",
6
6
  "repository": "tanstack/router",
7
7
  "homepage": "https://tanstack.com/router",
@@ -44,7 +44,7 @@
44
44
  "@tanstack/store": "^0.1.3",
45
45
  "tiny-invariant": "^1.3.1",
46
46
  "tiny-warning": "^1.0.3",
47
- "@tanstack/history": "0.0.1-beta.277"
47
+ "@tanstack/history": "0.0.1-beta.278"
48
48
  },
49
49
  "scripts": {
50
50
  "build": "rollup --config rollup.config.js"
package/src/Matches.tsx CHANGED
@@ -95,6 +95,8 @@ export function Match({ matchId }: { matchId: string }) {
95
95
  const PendingComponent = (route.options.pendingComponent ??
96
96
  router.options.defaultPendingComponent) as any
97
97
 
98
+ const pendingElement = PendingComponent ? <PendingComponent /> : null
99
+
98
100
  const routeErrorComponent =
99
101
  route.options.errorComponent ??
100
102
  router.options.defaultErrorComponent ??
@@ -115,7 +117,7 @@ export function Match({ matchId }: { matchId: string }) {
115
117
 
116
118
  return (
117
119
  <matchContext.Provider value={matchId}>
118
- <ResolvedSuspenseBoundary fallback={PendingComponent}>
120
+ <ResolvedSuspenseBoundary fallback={pendingElement}>
119
121
  <ResolvedCatchBoundary
120
122
  getResetKey={() => router.state.resolvedLocation.state?.key}
121
123
  errorComponent={routeErrorComponent}
@@ -123,7 +125,7 @@ export function Match({ matchId }: { matchId: string }) {
123
125
  warning(false, `Error in route match: ${matchId}`)
124
126
  }}
125
127
  >
126
- <MatchInner matchId={matchId!} pendingElement={PendingComponent} />
128
+ <MatchInner matchId={matchId!} pendingElement={pendingElement} />
127
129
  </ResolvedCatchBoundary>
128
130
  </ResolvedSuspenseBoundary>
129
131
  </matchContext.Provider>
@@ -161,7 +163,7 @@ function MatchInner({
161
163
 
162
164
  if (match.status === 'pending') {
163
165
  if (match.showPending) {
164
- return pendingElement || null
166
+ return pendingElement
165
167
  }
166
168
  throw match.loadPromise
167
169
  }
@@ -218,6 +220,7 @@ export type UseMatchRouteOptions<
218
220
  export function useMatchRoute<
219
221
  TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
220
222
  >() {
223
+ useRouterState({ select: (s) => [s.location, s.resolvedLocation] })
221
224
  const { matchRoute } = useRouter()
222
225
 
223
226
  return React.useCallback(
package/src/router.ts CHANGED
@@ -989,11 +989,11 @@ export class Router<
989
989
  let firstBadMatchIndex: number | undefined
990
990
 
991
991
  const updateMatch = (match: AnyRouteMatch) => {
992
- const isPreload = this.state.preloadMatches.find((d) => d.id === match.id)
992
+ // const isPreload = this.state.preloadMatches.find((d) => d.id === match.id)
993
993
  const isPending = this.state.pendingMatches?.find(
994
994
  (d) => d.id === match.id,
995
995
  )
996
- const matchesKey = isPreload
996
+ const matchesKey = preload
997
997
  ? 'preloadMatches'
998
998
  : isPending
999
999
  ? 'pendingMatches'