@tanstack/react-router 1.51.9 → 1.52.2

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/react-router",
3
- "version": "1.51.9",
3
+ "version": "1.52.2",
4
4
  "description": "Modern and scalable routing for React applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
package/src/Match.tsx CHANGED
@@ -129,8 +129,8 @@ export const MatchInner = React.memo(function MatchInnerImpl({
129
129
 
130
130
  const out = React.useMemo(() => {
131
131
  const Comp = route.options.component ?? router.options.defaultComponent
132
- return Comp ? <Comp key={routeId} /> : <Outlet />
133
- }, [routeId, route.options.component, router.options.defaultComponent])
132
+ return Comp ? <Comp /> : <Outlet />
133
+ }, [route.options.component, router.options.defaultComponent])
134
134
 
135
135
  // function useChangedDiff(value: any) {
136
136
  // const ref = React.useRef(value)
package/src/router.ts CHANGED
@@ -2133,7 +2133,7 @@ export class Router<
2133
2133
  (async () => {
2134
2134
  const { loaderPromise: prevLoaderPromise } =
2135
2135
  this.getMatch(matchId)!
2136
-
2136
+ let loaderRunningAsync = false
2137
2137
  if (prevLoaderPromise) {
2138
2138
  await prevLoaderPromise
2139
2139
  } else {
@@ -2328,13 +2328,12 @@ export class Router<
2328
2328
 
2329
2329
  // If the route is successful and still fresh, just resolve
2330
2330
  const { status, invalid } = this.getMatch(matchId)!
2331
-
2332
- if (preload && route.options.preload === false) {
2333
- // Do nothing
2334
- } else if (
2331
+ loaderRunningAsync =
2335
2332
  status === 'success' &&
2336
2333
  (invalid || (shouldReload ?? age > staleAge))
2337
- ) {
2334
+ if (preload && route.options.preload === false) {
2335
+ // Do nothing
2336
+ } else if (loaderRunningAsync) {
2338
2337
  ;(async () => {
2339
2338
  try {
2340
2339
  await runLoader()
@@ -2353,7 +2352,7 @@ export class Router<
2353
2352
 
2354
2353
  updateMatch(matchId, (prev) => ({
2355
2354
  ...prev,
2356
- isFetching: false,
2355
+ isFetching: loaderRunningAsync ? prev.isFetching : false,
2357
2356
  loaderPromise: undefined,
2358
2357
  }))
2359
2358
  })(),