@tanstack/react-router 1.31.4 → 1.31.6

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.
@@ -156,7 +156,7 @@ export declare function createRouter<TRouteTree extends AnyRoute, TTrailingSlash
156
156
  export declare class Router<in out TRouteTree extends AnyRoute, in out TTrailingSlashOption extends TrailingSlashOption, in out TDehydrated extends Record<string, any> = Record<string, any>, in out TSerializedError extends Record<string, any> = Record<string, any>> {
157
157
  tempLocationKey: string | undefined;
158
158
  resetNextScroll: boolean;
159
- shouldViewTransition?: true;
159
+ shouldViewTransition?: boolean;
160
160
  latestLoadPromise: Promise<void>;
161
161
  subscribers: Set<RouterListener<RouterEvent>>;
162
162
  injectedHtml: Array<InjectedHtmlEntry>;
@@ -196,7 +196,7 @@ export declare class Router<in out TRouteTree extends AnyRoute, in out TTrailing
196
196
  cancelMatches: () => void;
197
197
  buildLocation: BuildLocationFn<TRouteTree>;
198
198
  commitLocation: ({ startTransition, viewTransition, ...next }: ParsedLocation & CommitLocationOptions) => Promise<void>;
199
- buildAndCommitLocation: ({ replace, resetScroll, startTransition, ...rest }?: BuildNextOptions & CommitLocationOptions) => Promise<void>;
199
+ buildAndCommitLocation: ({ replace, resetScroll, startTransition, viewTransition, ...rest }?: BuildNextOptions & CommitLocationOptions) => Promise<void>;
200
200
  navigate: NavigateFn;
201
201
  load: () => Promise<void>;
202
202
  startViewTransition: (fn: () => Promise<void>) => Promise<void>;
@@ -47,12 +47,7 @@ function Transitioner() {
47
47
  }
48
48
  };
49
49
  useLayoutEffect(() => {
50
- const unsub = router.history.subscribe(() => {
51
- router.latestLocation = router.parseLocation(router.latestLocation);
52
- if (router.state.location !== router.latestLocation) {
53
- tryLoad();
54
- }
55
- });
50
+ const unsub = router.history.subscribe(router.load);
56
51
  const nextLocation = router.buildLocation({
57
52
  to: router.latestLocation.pathname,
58
53
  search: true,
@@ -1 +1 @@
1
- {"version":3,"file":"RouterProvider.js","sources":["../../src/RouterProvider.tsx"],"sourcesContent":["import * as React from 'react'\nimport { flushSync } from 'react-dom'\nimport { Matches } from './Matches'\nimport { pick, useLayoutEffect } from './utils'\nimport { useRouter } from './useRouter'\nimport { useRouterState } from './useRouterState'\nimport { getRouterContext } from './routerContext'\nimport type { NavigateOptions, ToOptions } from './link'\nimport type { ParsedLocation } from './location'\nimport type { AnyRoute } from './route'\nimport type { RoutePaths } from './routeInfo'\nimport type {\n AnyRouter,\n RegisteredRouter,\n Router,\n RouterOptions,\n RouterState,\n} from './router'\n\nimport type { MakeRouteMatch } from './Matches'\n\nexport interface CommitLocationOptions {\n replace?: boolean\n resetScroll?: boolean\n viewTransition?: boolean\n /**\n * @deprecated All navigations use React transitions under the hood now\n **/\n startTransition?: boolean\n}\n\nexport interface MatchLocation {\n to?: string | number | null\n fuzzy?: boolean\n caseSensitive?: boolean\n from?: string\n}\n\nexport type NavigateFn = <\n TTo extends string,\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n TMaskTo extends string = '',\n>(\n opts: NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n) => Promise<void>\n\nexport type BuildLocationFn<TRouteTree extends AnyRoute> = <\n TTo extends string,\n TFrom extends RoutePaths<TRouteTree> | string = string,\n TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom,\n TMaskTo extends string = '',\n>(\n opts: ToOptions<\n Router<TRouteTree, 'never'>,\n TFrom,\n TTo,\n TMaskFrom,\n TMaskTo\n > & {\n leaveParams?: boolean\n },\n) => ParsedLocation\n\nexport type InjectedHtmlEntry = string | (() => Promise<string> | string)\n\nexport function RouterProvider<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n>({ router, ...rest }: RouterProps<TRouter, TDehydrated>) {\n // Allow the router to update options on the router instance\n router.update({\n ...router.options,\n ...rest,\n context: {\n ...router.options.context,\n ...rest.context,\n },\n } as any)\n\n const matches = router.options.InnerWrap ? (\n <router.options.InnerWrap>\n <Matches />\n </router.options.InnerWrap>\n ) : (\n <Matches />\n )\n\n const routerContext = getRouterContext()\n\n const provider = (\n <React.Suspense fallback={null}>\n <routerContext.Provider value={router}>\n {matches}\n <Transitioner />\n </routerContext.Provider>\n </React.Suspense>\n )\n\n if (router.options.Wrap) {\n return <router.options.Wrap>{provider}</router.options.Wrap>\n }\n\n return provider\n}\n\nfunction Transitioner() {\n const router = useRouter()\n const mountLoadForRouter = React.useRef({ router, mounted: false })\n const routerState = useRouterState({\n select: (s) =>\n pick(s, ['isLoading', 'location', 'resolvedLocation', 'isTransitioning']),\n })\n\n const [isTransitioning, startReactTransition_] = React.useTransition()\n // Track pending state changes\n const hasPendingMatches = useRouterState({\n select: (s) => s.matches.some((d) => d.status === 'pending'),\n })\n\n const previousIsLoading = usePrevious(routerState.isLoading)\n\n const isAnyPending =\n routerState.isLoading || isTransitioning || hasPendingMatches\n const previousIsAnyPending = usePrevious(isAnyPending)\n\n router.startReactTransition = startReactTransition_\n\n const tryLoad = async () => {\n try {\n await router.load()\n } catch (err) {\n console.error(err)\n }\n }\n\n // Subscribe to location changes\n // and try to load the new location\n useLayoutEffect(() => {\n const unsub = router.history.subscribe(() => {\n router.latestLocation = router.parseLocation(router.latestLocation)\n if (router.state.location !== router.latestLocation) {\n tryLoad()\n }\n })\n\n const nextLocation = router.buildLocation({\n to: router.latestLocation.pathname,\n search: true,\n params: true,\n hash: true,\n state: true,\n })\n\n if (routerState.location.href !== nextLocation.href) {\n router.commitLocation({ ...nextLocation, replace: true })\n }\n\n return () => {\n unsub()\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [router, router.history])\n\n // Try to load the initial location\n useLayoutEffect(() => {\n if (\n window.__TSR_DEHYDRATED__ ||\n (mountLoadForRouter.current.router === router &&\n mountLoadForRouter.current.mounted)\n ) {\n return\n }\n mountLoadForRouter.current = { router, mounted: true }\n tryLoad()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [router])\n\n useLayoutEffect(() => {\n // The router was loading and now it's not\n if (previousIsLoading && !routerState.isLoading) {\n const toLocation = router.state.location\n const fromLocation = router.state.resolvedLocation\n const pathChanged = fromLocation.href !== toLocation.href\n\n router.emit({\n type: 'onLoad',\n fromLocation,\n toLocation,\n pathChanged,\n })\n\n // if (router.viewTransitionPromise) {\n // console.log('resolving view transition promise')\n // }\n\n // router.viewTransitionPromise?.resolve(true)\n }\n }, [previousIsLoading, router, routerState.isLoading])\n\n useLayoutEffect(() => {\n // The router was pending and now it's not\n if (previousIsAnyPending && !isAnyPending) {\n const toLocation = router.state.location\n const fromLocation = router.state.resolvedLocation\n const pathChanged = fromLocation.href !== toLocation.href\n\n router.emit({\n type: 'onResolved',\n fromLocation,\n toLocation,\n pathChanged,\n })\n\n router.__store.setState((s) => ({\n ...s,\n status: 'idle',\n resolvedLocation: s.location,\n }))\n\n if ((document as any).querySelector) {\n if (router.state.location.hash !== '') {\n const el = document.getElementById(router.state.location.hash)\n if (el) {\n el.scrollIntoView()\n }\n }\n }\n }\n }, [isAnyPending, previousIsAnyPending, router])\n\n return null\n}\n\nexport function getRouteMatch<TRouteTree extends AnyRoute>(\n state: RouterState<TRouteTree>,\n id: string,\n): undefined | MakeRouteMatch<TRouteTree> {\n return [\n ...state.cachedMatches,\n ...(state.pendingMatches ?? []),\n ...state.matches,\n ].find((d) => d.id === id)\n}\n\nexport type RouterProps<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n> = Omit<\n RouterOptions<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>,\n TDehydrated\n >,\n 'context'\n> & {\n router: Router<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>\n >\n context?: Partial<\n RouterOptions<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>,\n TDehydrated\n >['context']\n >\n}\n\nfunction usePrevious<T>(value: T) {\n const ref = React.useRef<T>(value)\n React.useEffect(() => {\n ref.current = value\n })\n return ref.current\n}\n"],"names":[],"mappings":";;;;;;;AAmEO,SAAS,eAGd,EAAE,QAAQ,GAAG,QAA2C;AAExD,SAAO,OAAO;AAAA,IACZ,GAAG,OAAO;AAAA,IACV,GAAG;AAAA,IACH,SAAS;AAAA,MACP,GAAG,OAAO,QAAQ;AAAA,MAClB,GAAG,KAAK;AAAA,IACV;AAAA,EAAA,CACM;AAER,QAAM,UAAU,OAAO,QAAQ,gCAC5B,OAAO,QAAQ,WAAf,EACC,UAAC,oBAAA,SAAA,EAAQ,EACX,CAAA,wBAEC,SAAQ,CAAA,CAAA;AAGX,QAAM,gBAAgB;AAEtB,QAAM,WACJ,oBAAC,MAAM,UAAN,EAAe,UAAU,MACxB,UAAA,qBAAC,cAAc,UAAd,EAAuB,OAAO,QAC5B,UAAA;AAAA,IAAA;AAAA,wBACA,cAAa,EAAA;AAAA,EAAA,EAChB,CAAA,EACF,CAAA;AAGE,MAAA,OAAO,QAAQ,MAAM;AACvB,WAAQ,oBAAA,OAAO,QAAQ,MAAf,EAAqB,UAAS,SAAA,CAAA;AAAA,EACxC;AAEO,SAAA;AACT;AAEA,SAAS,eAAe;AACtB,QAAM,SAAS;AACf,QAAM,qBAAqB,MAAM,OAAO,EAAE,QAAQ,SAAS,OAAO;AAClE,QAAM,cAAc,eAAe;AAAA,IACjC,QAAQ,CAAC,MACP,KAAK,GAAG,CAAC,aAAa,YAAY,oBAAoB,iBAAiB,CAAC;AAAA,EAAA,CAC3E;AAED,QAAM,CAAC,iBAAiB,qBAAqB,IAAI,MAAM,cAAc;AAErE,QAAM,oBAAoB,eAAe;AAAA,IACvC,QAAQ,CAAC,MAAM,EAAE,QAAQ,KAAK,CAAC,MAAM,EAAE,WAAW,SAAS;AAAA,EAAA,CAC5D;AAEK,QAAA,oBAAoB,YAAY,YAAY,SAAS;AAErD,QAAA,eACJ,YAAY,aAAa,mBAAmB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Ac;AACnC,YAAA,aAAa,OAAO,MAAM;AAC1B,YAAA,eAAe,OAAO,MAAM;AAC5B,YAAA,cAAc,aAAa,SAAS,WAAW;AAErD,aAAO,KAAK;AAAA,QACV,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA;AAAA,MAAA,CACD;AAEM,aAAA,QAAQ,SAAS,CAAC,OAAO;AAAA,QAC9B,GAAG;AAAA,QACH,QAAQ;AAAA,QACR,kBAAkB,EAAE;AAAA,MACpB,EAAA;AAEF,UAAK,SAAiB,eAAe;AACnC,YAAI,OAAO,MAAM,SAAS,SAAS,IAAI;AACrC,gBAAM,KAAK,SAAS,eAAe,OAAO,MAAM,SAAS,IAAI;AAC7D,cAAI,IAAI;AACN,eAAG,eAAe;AAAA,UACpB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACC,GAAA,CAAC,cAAc,sBAAsB,MAAM,CAAC;AAExC,SAAA;AACT;AAEgB,SAAA,cACd,OACA,IACwC;AACjC,SAAA;AAAA,IACL,GAAG,MAAM;AAAA,IACT,GAAI,MAAM,kBAAkB,CAAC;AAAA,IAC7B,GAAG,MAAM;AAAA,EAAA,EACT,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE;AAC3B;AA0BA,SAAS,YAAe,OAAU;AAC1B,QAAA,MAAM,MAAM,OAAU,KAAK;AACjC,QAAM,UAAU,MAAM;AACpB,QAAI,UAAU;AAAA,EAAA,CACf;AACD,SAAO,IAAI;AACb;"}
1
+ {"version":3,"file":"RouterProvider.js","sources":["../../src/RouterProvider.tsx"],"sourcesContent":["import * as React from 'react'\nimport { flushSync } from 'react-dom'\nimport { Matches } from './Matches'\nimport { pick, useLayoutEffect } from './utils'\nimport { useRouter } from './useRouter'\nimport { useRouterState } from './useRouterState'\nimport { getRouterContext } from './routerContext'\nimport type { NavigateOptions, ToOptions } from './link'\nimport type { ParsedLocation } from './location'\nimport type { AnyRoute } from './route'\nimport type { RoutePaths } from './routeInfo'\nimport type {\n AnyRouter,\n RegisteredRouter,\n Router,\n RouterOptions,\n RouterState,\n} from './router'\n\nimport type { MakeRouteMatch } from './Matches'\n\nexport interface CommitLocationOptions {\n replace?: boolean\n resetScroll?: boolean\n viewTransition?: boolean\n /**\n * @deprecated All navigations use React transitions under the hood now\n **/\n startTransition?: boolean\n}\n\nexport interface MatchLocation {\n to?: string | number | null\n fuzzy?: boolean\n caseSensitive?: boolean\n from?: string\n}\n\nexport type NavigateFn = <\n TTo extends string,\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n TMaskTo extends string = '',\n>(\n opts: NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n) => Promise<void>\n\nexport type BuildLocationFn<TRouteTree extends AnyRoute> = <\n TTo extends string,\n TFrom extends RoutePaths<TRouteTree> | string = string,\n TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom,\n TMaskTo extends string = '',\n>(\n opts: ToOptions<\n Router<TRouteTree, 'never'>,\n TFrom,\n TTo,\n TMaskFrom,\n TMaskTo\n > & {\n leaveParams?: boolean\n },\n) => ParsedLocation\n\nexport type InjectedHtmlEntry = string | (() => Promise<string> | string)\n\nexport function RouterProvider<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n>({ router, ...rest }: RouterProps<TRouter, TDehydrated>) {\n // Allow the router to update options on the router instance\n router.update({\n ...router.options,\n ...rest,\n context: {\n ...router.options.context,\n ...rest.context,\n },\n } as any)\n\n const matches = router.options.InnerWrap ? (\n <router.options.InnerWrap>\n <Matches />\n </router.options.InnerWrap>\n ) : (\n <Matches />\n )\n\n const routerContext = getRouterContext()\n\n const provider = (\n <React.Suspense fallback={null}>\n <routerContext.Provider value={router}>\n {matches}\n <Transitioner />\n </routerContext.Provider>\n </React.Suspense>\n )\n\n if (router.options.Wrap) {\n return <router.options.Wrap>{provider}</router.options.Wrap>\n }\n\n return provider\n}\n\nfunction Transitioner() {\n const router = useRouter()\n const mountLoadForRouter = React.useRef({ router, mounted: false })\n const routerState = useRouterState({\n select: (s) =>\n pick(s, ['isLoading', 'location', 'resolvedLocation', 'isTransitioning']),\n })\n\n const [isTransitioning, startReactTransition_] = React.useTransition()\n // Track pending state changes\n const hasPendingMatches = useRouterState({\n select: (s) => s.matches.some((d) => d.status === 'pending'),\n })\n\n const previousIsLoading = usePrevious(routerState.isLoading)\n\n const isAnyPending =\n routerState.isLoading || isTransitioning || hasPendingMatches\n const previousIsAnyPending = usePrevious(isAnyPending)\n\n router.startReactTransition = startReactTransition_\n\n const tryLoad = async () => {\n try {\n await router.load()\n } catch (err) {\n console.error(err)\n }\n }\n\n // Subscribe to location changes\n // and try to load the new location\n useLayoutEffect(() => {\n const unsub = router.history.subscribe(router.load)\n\n const nextLocation = router.buildLocation({\n to: router.latestLocation.pathname,\n search: true,\n params: true,\n hash: true,\n state: true,\n })\n\n if (routerState.location.href !== nextLocation.href) {\n router.commitLocation({ ...nextLocation, replace: true })\n }\n\n return () => {\n unsub()\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [router, router.history])\n\n // Try to load the initial location\n useLayoutEffect(() => {\n if (\n window.__TSR_DEHYDRATED__ ||\n (mountLoadForRouter.current.router === router &&\n mountLoadForRouter.current.mounted)\n ) {\n return\n }\n mountLoadForRouter.current = { router, mounted: true }\n tryLoad()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [router])\n\n useLayoutEffect(() => {\n // The router was loading and now it's not\n if (previousIsLoading && !routerState.isLoading) {\n const toLocation = router.state.location\n const fromLocation = router.state.resolvedLocation\n const pathChanged = fromLocation.href !== toLocation.href\n\n router.emit({\n type: 'onLoad',\n fromLocation,\n toLocation,\n pathChanged,\n })\n\n // if (router.viewTransitionPromise) {\n // console.log('resolving view transition promise')\n // }\n\n // router.viewTransitionPromise?.resolve(true)\n }\n }, [previousIsLoading, router, routerState.isLoading])\n\n useLayoutEffect(() => {\n // The router was pending and now it's not\n if (previousIsAnyPending && !isAnyPending) {\n const toLocation = router.state.location\n const fromLocation = router.state.resolvedLocation\n const pathChanged = fromLocation.href !== toLocation.href\n\n router.emit({\n type: 'onResolved',\n fromLocation,\n toLocation,\n pathChanged,\n })\n\n router.__store.setState((s) => ({\n ...s,\n status: 'idle',\n resolvedLocation: s.location,\n }))\n\n if ((document as any).querySelector) {\n if (router.state.location.hash !== '') {\n const el = document.getElementById(router.state.location.hash)\n if (el) {\n el.scrollIntoView()\n }\n }\n }\n }\n }, [isAnyPending, previousIsAnyPending, router])\n\n return null\n}\n\nexport function getRouteMatch<TRouteTree extends AnyRoute>(\n state: RouterState<TRouteTree>,\n id: string,\n): undefined | MakeRouteMatch<TRouteTree> {\n return [\n ...state.cachedMatches,\n ...(state.pendingMatches ?? []),\n ...state.matches,\n ].find((d) => d.id === id)\n}\n\nexport type RouterProps<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n> = Omit<\n RouterOptions<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>,\n TDehydrated\n >,\n 'context'\n> & {\n router: Router<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>\n >\n context?: Partial<\n RouterOptions<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>,\n TDehydrated\n >['context']\n >\n}\n\nfunction usePrevious<T>(value: T) {\n const ref = React.useRef<T>(value)\n React.useEffect(() => {\n ref.current = value\n })\n return ref.current\n}\n"],"names":[],"mappings":";;;;;;;AAmEO,SAAS,eAGd,EAAE,QAAQ,GAAG,QAA2C;AAExD,SAAO,OAAO;AAAA,IACZ,GAAG,OAAO;AAAA,IACV,GAAG;AAAA,IACH,SAAS;AAAA,MACP,GAAG,OAAO,QAAQ;AAAA,MAClB,GAAG,KAAK;AAAA,IACV;AAAA,EAAA,CACM;AAER,QAAM,UAAU,OAAO,QAAQ,gCAC5B,OAAO,QAAQ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ACpB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACC,GAAA,CAAC,cAAc,sBAAsB,MAAM,CAAC;AAExC,SAAA;AACT;AAEgB,SAAA,cACd,OACA,IACwC;AACjC,SAAA;AAAA,IACL,GAAG,MAAM;AAAA,IACT,GAAI,MAAM,kBAAkB,CAAC;AAAA,IAC7B,GAAG,MAAM;AAAA,EAAA,EACT,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE;AAC3B;AA0BA,SAAS,YAAe,OAAU;AAC1B,QAAA,MAAM,MAAM,OAAU,KAAK;AACjC,QAAM,UAAU,MAAM;AACpB,QAAI,UAAU;AAAA,EAAA,CACf;AACD,SAAO,IAAI;AACb;"}
@@ -156,7 +156,7 @@ export declare function createRouter<TRouteTree extends AnyRoute, TTrailingSlash
156
156
  export declare class Router<in out TRouteTree extends AnyRoute, in out TTrailingSlashOption extends TrailingSlashOption, in out TDehydrated extends Record<string, any> = Record<string, any>, in out TSerializedError extends Record<string, any> = Record<string, any>> {
157
157
  tempLocationKey: string | undefined;
158
158
  resetNextScroll: boolean;
159
- shouldViewTransition?: true;
159
+ shouldViewTransition?: boolean;
160
160
  latestLoadPromise: Promise<void>;
161
161
  subscribers: Set<RouterListener<RouterEvent>>;
162
162
  injectedHtml: Array<InjectedHtmlEntry>;
@@ -196,7 +196,7 @@ export declare class Router<in out TRouteTree extends AnyRoute, in out TTrailing
196
196
  cancelMatches: () => void;
197
197
  buildLocation: BuildLocationFn<TRouteTree>;
198
198
  commitLocation: ({ startTransition, viewTransition, ...next }: ParsedLocation & CommitLocationOptions) => Promise<void>;
199
- buildAndCommitLocation: ({ replace, resetScroll, startTransition, ...rest }?: BuildNextOptions & CommitLocationOptions) => Promise<void>;
199
+ buildAndCommitLocation: ({ replace, resetScroll, startTransition, viewTransition, ...rest }?: BuildNextOptions & CommitLocationOptions) => Promise<void>;
200
200
  navigate: NavigateFn;
201
201
  load: () => Promise<void>;
202
202
  startViewTransition: (fn: () => Promise<void>) => Promise<void>;
@@ -505,7 +505,9 @@ class Router {
505
505
  ...next
506
506
  }) => {
507
507
  const isSameUrl = this.latestLocation.href === next.href;
508
- if (!isSameUrl) {
508
+ if (isSameUrl) {
509
+ this.load();
510
+ } else {
509
511
  let { maskedLocation, ...nextHistory } = next;
510
512
  if (maskedLocation) {
511
513
  nextHistory = {
@@ -529,9 +531,7 @@ class Router {
529
531
  nextHistory.state.__tempKey = this.tempLocationKey;
530
532
  }
531
533
  }
532
- if (viewTransition) {
533
- this.shouldViewTransition = true;
534
- }
534
+ this.shouldViewTransition = viewTransition;
535
535
  this.history[next.replace ? "replace" : "push"](
536
536
  nextHistory.href,
537
537
  nextHistory.state
@@ -544,12 +544,14 @@ class Router {
544
544
  replace,
545
545
  resetScroll,
546
546
  startTransition,
547
+ viewTransition,
547
548
  ...rest
548
549
  } = {}) => {
549
550
  const location = this.buildLocation(rest);
550
551
  return this.commitLocation({
551
552
  ...location,
552
553
  startTransition,
554
+ viewTransition,
553
555
  replace,
554
556
  resetScroll
555
557
  });
@@ -574,6 +576,10 @@ class Router {
574
576
  });
575
577
  };
576
578
  this.load = async () => {
579
+ this.latestLocation = this.parseLocation(this.latestLocation);
580
+ if (this.state.location === this.latestLocation) {
581
+ return;
582
+ }
577
583
  const promise = createControlledPromise();
578
584
  this.latestLoadPromise = promise;
579
585
  let redirect;