@tanstack/router-core 1.171.21 → 1.171.23

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/link.ts CHANGED
@@ -677,9 +677,9 @@ export interface LinkOptionsProps {
677
677
  */
678
678
  preload?: false | 'intent' | 'viewport' | 'render'
679
679
  /**
680
- * When the intent preload strategy is set, this delays focus and hover
681
- * preloading by this many milliseconds. Touch intent preloads immediately.
682
- * If focus or hover exits before this delay, the preload will be cancelled.
680
+ * Delays focus, hover, and viewport preloading by this many milliseconds.
681
+ * Touch intent preloads immediately. If focus or hover ends, or the link
682
+ * leaves the viewport before this delay, the preload will be cancelled.
683
683
  */
684
684
  preloadDelay?: number
685
685
  /**
@@ -750,7 +750,7 @@ function createLoaderTask(
750
750
  const match = lane[1 /* matches */][index]!
751
751
  const route = getRoute(router, match)
752
752
  const preload = !!options[4 /* preload */]
753
- const plannedCacheMatch = preload ? router._cache.get(match.id) : undefined
753
+ const plannedCacheMatch = router._cache.get(match.id)
754
754
  let configured
755
755
  let reload = false
756
756
  let reloadFailure: LoaderOutcome | undefined
@@ -878,10 +878,16 @@ function createLoaderTask(
878
878
  if (blocking) {
879
879
  settleInto(match, result, preload)
880
880
  if (result[0 /* kind */] === SUCCESS) {
881
+ // A settled generation can outlive its lane without keeping unresolved
882
+ // navigation work alive. Refresh generations remain private for rollback.
881
883
  if (
882
- preload &&
883
884
  routeLoader &&
884
- !options[0 /* controller */].signal.aborted
885
+ !options[0 /* controller */].signal.aborted &&
886
+ !(
887
+ process.env.NODE_ENV !== 'production' &&
888
+ !preload &&
889
+ router._tx?.[6 /* refresh */]
890
+ )
885
891
  ) {
886
892
  cacheLoaderMatch(router, match, plannedCacheMatch)
887
893
  }
package/src/route.ts CHANGED
@@ -55,7 +55,7 @@ export type AnyContext = {}
55
55
 
56
56
  export interface RouteContext {}
57
57
 
58
- export type PreloadableObj = { preload?: () => Promise<void> }
58
+ export type PreloadableObj = { preload?: () => Promise<void> | undefined }
59
59
 
60
60
  export type RoutePathOptions<TCustomId, TPath> =
61
61
  | {
package/src/router.ts CHANGED
@@ -213,7 +213,8 @@ export interface RouterOptions<
213
213
  */
214
214
  defaultPreload?: false | 'intent' | 'viewport' | 'render'
215
215
  /**
216
- * The delay in milliseconds that a route must be hovered over or touched before it is preloaded.
216
+ * The delay in milliseconds before intent focus/hover and viewport preloading.
217
+ * Touch intent preloads immediately.
217
218
  *
218
219
  * @default 50
219
220
  * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloaddelay-property)