@tanstack/react-router 1.25.1 → 1.26.0

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/src/router.ts CHANGED
@@ -40,9 +40,9 @@ import type {
40
40
  AnyContext,
41
41
  AnyRoute,
42
42
  AnySearchSchema,
43
+ ErrorRouteComponent,
43
44
  LoaderFnContext,
44
45
  NotFoundRouteComponent,
45
- Route,
46
46
  RouteMask,
47
47
  } from './route'
48
48
  import type {
@@ -122,7 +122,7 @@ export interface RouterOptions<
122
122
  defaultPreload?: false | 'intent'
123
123
  defaultPreloadDelay?: number
124
124
  defaultComponent?: RouteComponent
125
- defaultErrorComponent?: RouteComponent
125
+ defaultErrorComponent?: ErrorRouteComponent
126
126
  defaultPendingComponent?: RouteComponent
127
127
  defaultPendingMs?: number
128
128
  defaultPendingMinMs?: number
@@ -1545,9 +1545,10 @@ export class Router<
1545
1545
  }
1546
1546
 
1547
1547
  invalidate = () => {
1548
- const invalidate = (d: any) => ({
1548
+ const invalidate = (d: RouteMatch<TRouteTree>) => ({
1549
1549
  ...d,
1550
1550
  invalid: true,
1551
+ ...(d.status === 'error' ? ({ status: 'pending' } as const) : {}),
1551
1552
  })
1552
1553
 
1553
1554
  this.__store.setState((s) => ({
@@ -1557,7 +1558,7 @@ export class Router<
1557
1558
  pendingMatches: s.pendingMatches?.map(invalidate),
1558
1559
  }))
1559
1560
 
1560
- this.load()
1561
+ return this.load()
1561
1562
  }
1562
1563
 
1563
1564
  load = async (): Promise<void> => {