@depup/tanstack__react-router 1.166.8-depup.0 → 1.167.0-depup.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.
@@ -979,7 +979,7 @@ type beforeLoad = (
979
979
  - Type:
980
980
 
981
981
  \`\`\`tsx
982
- type loader = (
982
+ type loaderFn = (
983
983
  opts: RouteMatch & {
984
984
  abortController: AbortController
985
985
  cause: 'preload' | 'enter' | 'stay'
@@ -993,6 +993,13 @@ type loader = (
993
993
  route: AnyRoute
994
994
  },
995
995
  ) => Promise<TLoaderData> | TLoaderData | void
996
+
997
+ type loader =
998
+ | loaderFn
999
+ | {
1000
+ handler: loaderFn
1001
+ staleReloadMode?: 'background' | 'blocking'
1002
+ }
996
1003
  \`\`\`
997
1004
 
998
1005
  - Optional
@@ -1001,6 +1008,9 @@ type loader = (
1001
1008
  - If this function returns a promise, the route will be put into a pending state and cause rendering to suspend until the promise resolves. If this route's pendingMs threshold is reached, the \`pendingComponent\` will be shown until it resolves. If the promise rejects, the route will be put into an error state and the error will be thrown during render.
1002
1009
  - If this function returns a \`TLoaderData\` object, that object will be stored on the route match until the route match is no longer active. It can be accessed using the \`useLoaderData\` hook in any component that is a child of the route match before another \`<Outlet />\` is rendered.
1003
1010
  - Deps must be returned by your \`loaderDeps\` function in order to appear.
1011
+ - Use the object form to configure loader-specific behavior like \`staleReloadMode\`.
1012
+ - \`staleReloadMode: 'background'\` preserves stale-while-revalidate behavior for stale successful matches.
1013
+ - \`staleReloadMode: 'blocking'\` waits for the stale loader reload to complete before continuing.
1004
1014
 
1005
1015
  > 🚧 \`opts.navigate\` has been deprecated and will be removed in the next major release. Use \`throw redirect({ to: '/somewhere' })\` instead. Read more about the \`redirect\` function [here](./redirectFunction.md).
1006
1016
 
@@ -1518,6 +1528,15 @@ The \`RouterOptions\` type accepts an object with the following properties and m
1518
1528
  - Defaults to \`0\`
1519
1529
  - The default \`staleTime\` a route should use if no staleTime is provided.
1520
1530
 
1531
+ ### \`defaultStaleReloadMode\` property
1532
+
1533
+ - Type: \`'background' | 'blocking'\`
1534
+ - Optional
1535
+ - Defaults to \`'background'\`
1536
+ - Controls how stale successful loader data is revalidated by default.
1537
+ - \`'background'\` preserves stale-while-revalidate behavior.
1538
+ - \`'blocking'\` waits for the stale loader reload to finish before navigation resolves.
1539
+
1521
1540
  ### \`defaultPreloadStaleTime\` property
1522
1541
 
1523
1542
  - Type: \`number\`