@tanstack/vue-router 1.168.3 → 1.168.5
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/dist/esm/Match.js +1 -1
- package/dist/esm/Match.js.map +1 -1
- package/dist/esm/ScrollRestoration.js +2 -12
- package/dist/esm/ScrollRestoration.js.map +1 -1
- package/dist/esm/scroll-restoration.d.ts +0 -6
- package/dist/esm/scroll-restoration.js +4 -26
- package/dist/esm/scroll-restoration.js.map +1 -1
- package/dist/source/Match.jsx +5 -2
- package/dist/source/Match.jsx.map +1 -1
- package/dist/source/ScrollRestoration.jsx +2 -18
- package/dist/source/ScrollRestoration.jsx.map +1 -1
- package/dist/source/scroll-restoration.d.ts +0 -6
- package/dist/source/scroll-restoration.jsx +5 -47
- package/dist/source/scroll-restoration.jsx.map +1 -1
- package/package.json +5 -4
- package/src/Match.tsx +5 -2
- package/src/ScrollRestoration.tsx +2 -22
- package/src/scroll-restoration.tsx +5 -63
package/dist/esm/Match.js
CHANGED
|
@@ -76,7 +76,7 @@ var Match = Vue.defineComponent({
|
|
|
76
76
|
},
|
|
77
77
|
children: content
|
|
78
78
|
});
|
|
79
|
-
const withScrollRestoration = [content, isChildOfRoot
|
|
79
|
+
const withScrollRestoration = [content, isChildOfRoot ? Vue.h(Vue.Fragment, null, [Vue.h(OnRendered), router.options.scrollRestoration && (isServer ?? router.isServer) ? Vue.h(ScrollRestoration) : null]) : null].filter(Boolean);
|
|
80
80
|
if (withScrollRestoration.length === 1) return withScrollRestoration[0];
|
|
81
81
|
return Vue.h(Vue.Fragment, null, withScrollRestoration);
|
|
82
82
|
};
|
package/dist/esm/Match.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Match.js","names":["Vue","createControlledPromise","getLocationChangeInfo","invariant","isNotFound","isRedirect","rootRouteId","isServer","useStore","CatchBoundary","ErrorComponent","ClientOnly","useRouter","CatchNotFound","matchContext","pendingMatchContext","routeIdContext","renderRouteNotFound","ScrollRestoration","Match","defineComponent","name","props","matchId","type","String","required","setup","router","routeId","stores","activeMatchStoresById","get","process","env","NODE_ENV","Error","isChildOfRoot","routesById","parentRoute","id","activeMatch","getMatchStoreByRouteId","value","isPendingMatchRef","pendingRouteIds","Boolean","equal","Object","is","loadedAt","matchData","computed","match","ssr","_displayPending","route","PendingComponent","options","pendingComponent","defaultPendingComponent","pendingElement","h","undefined","routeErrorComponent","errorComponent","defaultErrorComponent","routeOnCatch","onCatch","defaultOnCatch","routeNotFoundComponent","isRoot","notFoundComponent","notFoundRoute","component","hasShellComponent","shellComponent","ShellComponent","provide","matchIdRef","actualMatchId","resolvedNoSsr","shouldClientOnly","renderMatchContent","matchInner","MatchInner","content","fallback","default","error","children","getResetKey","console","warn","withScrollRestoration","scrollRestoration","Fragment","OnRendered","filter","length","location","resolvedLocation","state","__TSR_key","prevHref","watch","currentHref","latestLocation","href","emit","immediate","inject","combinedState","matchRouteId","remountFn","remountDeps","defaultRemountDeps","remountKey","loaderDeps","params","_strictParams","search","_strictSearch","JSON","stringify","status","_forcePending","getMatch","_nonReactive","loadPromise","RouteErrorComponent","reset","invalidate","info","componentStack","pendingMinMs","defaultPendingMinMs","routerMatch","minPendingPromise","setTimeout","resolve","Comp","defaultComponent","key","Outlet","parentRouteId","parentMatch","v","parentGlobalNotFound","globalNotFound","childMatchIdMap","childMatchIdByRouteId","childMatchData","childId","child","paramsKey","nextMatch"],"sources":["../../src/Match.tsx"],"sourcesContent":["import * as Vue from 'vue'\nimport {\n createControlledPromise,\n getLocationChangeInfo,\n invariant,\n isNotFound,\n isRedirect,\n rootRouteId,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useStore } from '@tanstack/vue-store'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { ClientOnly } from './ClientOnly'\nimport { useRouter } from './useRouter'\nimport { CatchNotFound } from './not-found'\nimport {\n matchContext,\n pendingMatchContext,\n routeIdContext,\n} from './matchContext'\nimport { renderRouteNotFound } from './renderRouteNotFound'\nimport { ScrollRestoration } from './scroll-restoration'\nimport type { VNode } from 'vue'\nimport type { AnyRoute, RootRouteOptions } from '@tanstack/router-core'\n\nexport const Match = Vue.defineComponent({\n name: 'Match',\n props: {\n matchId: {\n type: String,\n required: true,\n },\n },\n setup(props) {\n const router = useRouter()\n\n // Derive routeId from initial props.matchId — stable for this component's\n // lifetime. The routeId never changes for a given route position in the\n // tree, even when matchId changes (loaderDepsHash, etc).\n const routeId = router.stores.activeMatchStoresById.get(\n props.matchId,\n )?.routeId\n\n if (!routeId) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `Invariant failed: Could not find routeId for matchId \"${props.matchId}\". Please file an issue!`,\n )\n }\n\n invariant()\n }\n\n // Static route-tree check: is this route a direct child of the root?\n // parentRoute is set at build time, so no reactive tracking needed.\n const isChildOfRoot =\n (router.routesById[routeId] as AnyRoute)?.parentRoute?.id === rootRouteId\n\n // Single stable store subscription — getMatchStoreByRouteId returns a\n // cached computed store that resolves routeId → current match state\n // through the signal graph. No bridge needed.\n const activeMatch = useStore(\n router.stores.getMatchStoreByRouteId(routeId),\n (value) => value,\n )\n const isPendingMatchRef = useStore(\n router.stores.pendingRouteIds,\n (pendingRouteIds) => Boolean(pendingRouteIds[routeId]),\n { equal: Object.is },\n )\n const loadedAt = useStore(router.stores.loadedAt, (value) => value)\n\n const matchData = Vue.computed(() => {\n const match = activeMatch.value\n if (!match) {\n return null\n }\n\n return {\n matchId: match.id,\n routeId,\n loadedAt: loadedAt.value,\n ssr: match.ssr,\n _displayPending: match._displayPending,\n }\n })\n\n const route = Vue.computed(() =>\n matchData.value ? router.routesById[matchData.value.routeId] : null,\n )\n\n const PendingComponent = Vue.computed(\n () =>\n route.value?.options?.pendingComponent ??\n router?.options?.defaultPendingComponent,\n )\n\n const pendingElement = Vue.computed(() =>\n PendingComponent.value ? Vue.h(PendingComponent.value) : undefined,\n )\n\n const routeErrorComponent = Vue.computed(\n () =>\n route.value?.options?.errorComponent ??\n router?.options?.defaultErrorComponent,\n )\n\n const routeOnCatch = Vue.computed(\n () => route.value?.options?.onCatch ?? router?.options?.defaultOnCatch,\n )\n\n const routeNotFoundComponent = Vue.computed(() =>\n route.value?.isRoot\n ? // If it's the root route, use the globalNotFound option, with fallback to the notFoundRoute's component\n (route.value?.options?.notFoundComponent ??\n router?.options?.notFoundRoute?.options?.component)\n : route.value?.options?.notFoundComponent,\n )\n\n const hasShellComponent = Vue.computed(() => {\n if (!route.value?.isRoot) return false\n return !!(route.value.options as RootRouteOptions).shellComponent\n })\n\n const ShellComponent = Vue.computed(() =>\n hasShellComponent.value\n ? ((route.value!.options as RootRouteOptions).shellComponent as any)\n : null,\n )\n\n // Provide routeId context (stable string) for children.\n // MatchInner, Outlet, and useMatch all consume this.\n Vue.provide(routeIdContext, routeId)\n\n // Provide reactive nearest-match context for hooks that slice the active\n // matches array relative to the current match.\n const matchIdRef = Vue.computed(\n () => activeMatch.value?.id ?? props.matchId,\n )\n Vue.provide(matchContext, matchIdRef)\n\n Vue.provide(pendingMatchContext, isPendingMatchRef)\n\n return (): VNode => {\n const actualMatchId = matchData.value?.matchId ?? props.matchId\n\n const resolvedNoSsr =\n matchData.value?.ssr === false || matchData.value?.ssr === 'data-only'\n const shouldClientOnly =\n resolvedNoSsr || !!matchData.value?._displayPending\n\n const renderMatchContent = (): VNode => {\n const matchInner = Vue.h(MatchInner, { matchId: actualMatchId })\n\n let content: VNode = shouldClientOnly\n ? Vue.h(\n ClientOnly,\n {\n fallback: pendingElement.value,\n },\n {\n default: () => matchInner,\n },\n )\n : matchInner\n\n // Wrap in NotFound boundary if needed\n if (routeNotFoundComponent.value) {\n content = Vue.h(CatchNotFound, {\n fallback: (error: any) => {\n // If the current not found handler doesn't exist or it has a\n // route ID which doesn't match the current route, rethrow the error\n if (\n !routeNotFoundComponent.value ||\n (error.routeId && error.routeId !== matchData.value?.routeId) ||\n (!error.routeId && route.value && !route.value.isRoot)\n )\n throw error\n\n return Vue.h(routeNotFoundComponent.value, error)\n },\n children: content,\n })\n }\n\n // Wrap in error boundary if needed\n if (routeErrorComponent.value) {\n content = CatchBoundary({\n getResetKey: () => matchData.value?.loadedAt ?? 0,\n errorComponent: routeErrorComponent.value || ErrorComponent,\n onCatch: (error: Error) => {\n // Forward not found errors (we don't want to show the error component for these)\n if (isNotFound(error)) throw error\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Warning: Error in route match: ${actualMatchId}`)\n }\n routeOnCatch.value?.(error)\n },\n children: content,\n })\n }\n\n // Add scroll restoration if needed\n const withScrollRestoration: Array<VNode> = [\n content,\n isChildOfRoot && router.options.scrollRestoration\n ? Vue.h(Vue.Fragment, null, [\n Vue.h(OnRendered),\n Vue.h(ScrollRestoration),\n ])\n : null,\n ].filter(Boolean) as Array<VNode>\n\n // Return single child directly to avoid Fragment wrapper that causes hydration mismatch\n if (withScrollRestoration.length === 1) {\n return withScrollRestoration[0]!\n }\n\n return Vue.h(Vue.Fragment, null, withScrollRestoration)\n }\n\n if (!hasShellComponent.value) {\n return renderMatchContent()\n }\n\n return Vue.h(ShellComponent.value, null, {\n // Important: return a fresh VNode on each slot invocation so that shell\n // components can re-render without reusing a cached VNode instance.\n default: () => renderMatchContent(),\n })\n }\n },\n})\n\n// On Rendered can't happen above the root layout because it actually\n// renders a dummy dom element to track the rendered state of the app.\n// We render a script tag with a key that changes based on the current\n// location state.__TSR_key. Also, because it's below the root layout, it\n// allows us to fire onRendered events even after a hydration mismatch\n// error that occurred above the root layout (like bad head/link tags,\n// which is common).\nconst OnRendered = Vue.defineComponent({\n name: 'OnRendered',\n setup() {\n const router = useRouter()\n\n const location = useStore(\n router.stores.resolvedLocation,\n (resolvedLocation) => resolvedLocation?.state.__TSR_key,\n )\n\n let prevHref: string | undefined\n\n Vue.watch(\n location,\n () => {\n if (location.value) {\n const currentHref = router.latestLocation.href\n if (prevHref === undefined || prevHref !== currentHref) {\n router.emit({\n type: 'onRendered',\n ...getLocationChangeInfo(\n router.stores.location.state,\n router.stores.resolvedLocation.state,\n ),\n })\n prevHref = currentHref\n }\n }\n },\n { immediate: true },\n )\n\n return () => null\n },\n})\n\nexport const MatchInner = Vue.defineComponent({\n name: 'MatchInner',\n props: {\n matchId: {\n type: String,\n required: true,\n },\n },\n setup(props) {\n const router = useRouter()\n\n // Use routeId from context (provided by parent Match) — stable string.\n const routeId = Vue.inject(routeIdContext)!\n const activeMatch = useStore(\n router.stores.getMatchStoreByRouteId(routeId),\n (value) => value,\n )\n\n // Combined selector for match state AND remount key\n // This ensures both are computed in the same selector call with consistent data\n const combinedState = Vue.computed(() => {\n const match = activeMatch.value\n if (!match) {\n // Route no longer exists - truly navigating away\n return null\n }\n\n const matchRouteId = match.routeId as string\n\n // Compute remount key\n const remountFn =\n (router.routesById[matchRouteId] as AnyRoute).options.remountDeps ??\n router.options.defaultRemountDeps\n\n let remountKey: string | undefined\n if (remountFn) {\n const remountDeps = remountFn({\n routeId: matchRouteId,\n loaderDeps: match.loaderDeps,\n params: match._strictParams,\n search: match._strictSearch,\n })\n remountKey = remountDeps ? JSON.stringify(remountDeps) : undefined\n }\n\n return {\n routeId: matchRouteId,\n match: {\n id: match.id,\n status: match.status,\n error: match.error,\n ssr: match.ssr,\n _forcePending: match._forcePending,\n _displayPending: match._displayPending,\n },\n remountKey,\n }\n })\n\n const route = Vue.computed(() => {\n if (!combinedState.value) return null\n return router.routesById[combinedState.value.routeId]!\n })\n\n const match = Vue.computed(() => combinedState.value?.match)\n const remountKey = Vue.computed(() => combinedState.value?.remountKey)\n\n return (): VNode | null => {\n // If match doesn't exist, return null (component is being unmounted or not ready)\n if (!combinedState.value || !match.value || !route.value) return null\n\n // Handle different match statuses\n if (match.value._displayPending) {\n const PendingComponent =\n route.value.options.pendingComponent ??\n router.options.defaultPendingComponent\n\n return PendingComponent ? Vue.h(PendingComponent) : null\n }\n\n if (match.value._forcePending) {\n const PendingComponent =\n route.value.options.pendingComponent ??\n router.options.defaultPendingComponent\n\n return PendingComponent ? Vue.h(PendingComponent) : null\n }\n\n if (match.value.status === 'notFound') {\n if (!isNotFound(match.value.error)) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Invariant failed: Expected a notFound error')\n }\n\n invariant()\n }\n return renderRouteNotFound(router, route.value, match.value.error)\n }\n\n if (match.value.status === 'redirected') {\n if (!isRedirect(match.value.error)) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Invariant failed: Expected a redirect error')\n }\n\n invariant()\n }\n throw router.getMatch(match.value.id)?._nonReactive.loadPromise\n }\n\n if (match.value.status === 'error') {\n // Check if this route or any parent has an error component\n const RouteErrorComponent =\n route.value.options.errorComponent ??\n router.options.defaultErrorComponent\n\n // If this route has an error component, render it directly\n // This is more reliable than relying on Vue's error boundary\n if (RouteErrorComponent) {\n return Vue.h(RouteErrorComponent, {\n error: match.value.error,\n reset: () => {\n router.invalidate()\n },\n info: {\n componentStack: '',\n },\n })\n }\n\n // If there's no error component for this route, throw the error\n // so it can bubble up to the nearest parent with an error component\n throw match.value.error\n }\n\n if (match.value.status === 'pending') {\n const pendingMinMs =\n route.value.options.pendingMinMs ?? router.options.defaultPendingMinMs\n\n const routerMatch = router.getMatch(match.value.id)\n if (\n pendingMinMs &&\n routerMatch &&\n !routerMatch._nonReactive.minPendingPromise\n ) {\n // Create a promise that will resolve after the minPendingMs\n if (!(isServer ?? router.isServer)) {\n const minPendingPromise = createControlledPromise<void>()\n\n routerMatch._nonReactive.minPendingPromise = minPendingPromise\n\n setTimeout(() => {\n minPendingPromise.resolve()\n // We've handled the minPendingPromise, so we can delete it\n routerMatch._nonReactive.minPendingPromise = undefined\n }, pendingMinMs)\n }\n }\n\n // In Vue, we render the pending component directly instead of throwing a promise\n // because Vue's Suspense doesn't catch thrown promises like React does\n const PendingComponent =\n route.value.options.pendingComponent ??\n router.options.defaultPendingComponent\n\n if (PendingComponent) {\n return Vue.h(PendingComponent)\n }\n\n // If no pending component, return null while loading\n return null\n }\n\n // Success status - render the component with remount key\n const Comp =\n route.value.options.component ?? router.options.defaultComponent\n const key = remountKey.value\n\n if (Comp) {\n // Pass key as a prop - Vue.h properly handles 'key' as a special prop\n return Vue.h(Comp, key !== undefined ? { key } : undefined)\n }\n\n return Vue.h(Outlet, key !== undefined ? { key } : undefined)\n }\n },\n})\n\nexport const Outlet = Vue.defineComponent({\n name: 'Outlet',\n setup() {\n const router = useRouter()\n const parentRouteId = Vue.inject(routeIdContext)\n\n if (!parentRouteId) {\n return (): VNode | null => null\n }\n\n // Parent state via stable routeId store — single subscription\n const parentMatch = useStore(\n router.stores.getMatchStoreByRouteId(parentRouteId),\n (v) => v,\n )\n\n const route = Vue.computed(() =>\n parentMatch.value\n ? router.routesById[parentMatch.value.routeId as string]!\n : undefined,\n )\n\n const parentGlobalNotFound = Vue.computed(\n () => parentMatch.value?.globalNotFound ?? false,\n )\n\n // Child match lookup: read the child matchId from the shared derived\n // map (one reactive node for the whole tree), then grab match state\n // directly from the pool.\n const childMatchIdMap = useStore(\n router.stores.childMatchIdByRouteId,\n (v) => v,\n )\n\n const childMatchData = Vue.computed(() => {\n const childId = childMatchIdMap.value[parentRouteId]\n if (!childId) return null\n const child = router.stores.activeMatchStoresById.get(childId)?.state\n if (!child) return null\n\n return {\n id: child.id,\n // Key based on routeId + params only (not loaderDeps)\n // This ensures component recreates when params change,\n // but NOT when only loaderDeps change\n paramsKey: child.routeId + JSON.stringify(child._strictParams),\n }\n })\n\n return (): VNode | null => {\n if (parentGlobalNotFound.value) {\n if (!route.value) {\n return null\n }\n return renderRouteNotFound(router, route.value, undefined)\n }\n\n if (!childMatchData.value) {\n return null\n }\n\n const nextMatch = Vue.h(Match, {\n matchId: childMatchData.value.id,\n key: childMatchData.value.paramsKey,\n })\n\n // Note: We intentionally do NOT wrap in Suspense here.\n // The top-level Suspense in Matches already covers the root.\n // The old code compared matchId (e.g. \"__root__/\") with rootRouteId (\"__root__\")\n // which never matched, so this Suspense was effectively dead code.\n // With routeId-based lookup, parentRouteId === rootRouteId would match,\n // causing a double-Suspense that corrupts Vue's DOM during updates.\n return nextMatch\n }\n },\n})\n"],"mappings":";;;;;;;;;;;;AAyBA,IAAamB,QAAQnB,IAAIoB,gBAAgB;CACvCC,MAAM;CACNC,OAAO,EACLC,SAAS;EACPC,MAAMC;EACNC,UAAU;EACZ,EACD;CACDC,MAAML,OAAO;EACX,MAAMM,SAAShB,WAAW;EAK1B,MAAMiB,UAAUD,OAAOE,OAAOC,sBAAsBC,IAClDV,MAAMC,QACP,EAAEM;AAEH,MAAI,CAACA,SAAS;AACZ,OAAA,QAAA,IAAA,aAA6B,aAC3B,OAAM,IAAIO,MACR,yDAAyDd,MAAMC,QAAO,0BACvE;AAGHpB,cAAW;;EAKb,MAAMkC,gBACHT,OAAOU,WAAWT,UAAuBU,aAAaC,OAAOlC;EAKhE,MAAMmC,cAAcjC,SAClBoB,OAAOE,OAAOY,uBAAuBb,QAAQ,GAC5Cc,UAAUA,MACZ;EACD,MAAMC,oBAAoBpC,SACxBoB,OAAOE,OAAOe,kBACbA,oBAAoBC,QAAQD,gBAAgBhB,SAAS,EACtD,EAAEkB,OAAOC,OAAOC,IAClB,CAAC;EACD,MAAMC,WAAW1C,SAASoB,OAAOE,OAAOoB,WAAWP,UAAUA,MAAM;EAEnE,MAAMQ,YAAYnD,IAAIoD,eAAe;GACnC,MAAMC,QAAQZ,YAAYE;AAC1B,OAAI,CAACU,MACH,QAAO;AAGT,UAAO;IACL9B,SAAS8B,MAAMb;IACfX;IACAqB,UAAUA,SAASP;IACnBW,KAAKD,MAAMC;IACXC,iBAAiBF,MAAME;IACxB;IACD;EAEF,MAAMC,QAAQxD,IAAIoD,eAChBD,UAAUR,QAAQf,OAAOU,WAAWa,UAAUR,MAAMd,WAAW,KAChE;EAED,MAAM4B,mBAAmBzD,IAAIoD,eAEzBI,MAAMb,OAAOe,SAASC,oBACtB/B,QAAQ8B,SAASE,wBACpB;EAED,MAAMC,iBAAiB7D,IAAIoD,eACzBK,i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|
1
|
+
{"version":3,"file":"Match.js","names":["Vue","createControlledPromise","getLocationChangeInfo","invariant","isNotFound","isRedirect","rootRouteId","isServer","useStore","CatchBoundary","ErrorComponent","ClientOnly","useRouter","CatchNotFound","matchContext","pendingMatchContext","routeIdContext","renderRouteNotFound","ScrollRestoration","Match","defineComponent","name","props","matchId","type","String","required","setup","router","routeId","stores","activeMatchStoresById","get","process","env","NODE_ENV","Error","isChildOfRoot","routesById","parentRoute","id","activeMatch","getMatchStoreByRouteId","value","isPendingMatchRef","pendingRouteIds","Boolean","equal","Object","is","loadedAt","matchData","computed","match","ssr","_displayPending","route","PendingComponent","options","pendingComponent","defaultPendingComponent","pendingElement","h","undefined","routeErrorComponent","errorComponent","defaultErrorComponent","routeOnCatch","onCatch","defaultOnCatch","routeNotFoundComponent","isRoot","notFoundComponent","notFoundRoute","component","hasShellComponent","shellComponent","ShellComponent","provide","matchIdRef","actualMatchId","resolvedNoSsr","shouldClientOnly","renderMatchContent","matchInner","MatchInner","content","fallback","default","error","children","getResetKey","console","warn","withScrollRestoration","Fragment","OnRendered","scrollRestoration","filter","length","location","resolvedLocation","state","__TSR_key","prevHref","watch","currentHref","latestLocation","href","emit","immediate","inject","combinedState","matchRouteId","remountFn","remountDeps","defaultRemountDeps","remountKey","loaderDeps","params","_strictParams","search","_strictSearch","JSON","stringify","status","_forcePending","getMatch","_nonReactive","loadPromise","RouteErrorComponent","reset","invalidate","info","componentStack","pendingMinMs","defaultPendingMinMs","routerMatch","minPendingPromise","setTimeout","resolve","Comp","defaultComponent","key","Outlet","parentRouteId","parentMatch","v","parentGlobalNotFound","globalNotFound","childMatchIdMap","childMatchIdByRouteId","childMatchData","childId","child","paramsKey","nextMatch"],"sources":["../../src/Match.tsx"],"sourcesContent":["import * as Vue from 'vue'\nimport {\n createControlledPromise,\n getLocationChangeInfo,\n invariant,\n isNotFound,\n isRedirect,\n rootRouteId,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useStore } from '@tanstack/vue-store'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { ClientOnly } from './ClientOnly'\nimport { useRouter } from './useRouter'\nimport { CatchNotFound } from './not-found'\nimport {\n matchContext,\n pendingMatchContext,\n routeIdContext,\n} from './matchContext'\nimport { renderRouteNotFound } from './renderRouteNotFound'\nimport { ScrollRestoration } from './scroll-restoration'\nimport type { VNode } from 'vue'\nimport type { AnyRoute, RootRouteOptions } from '@tanstack/router-core'\n\nexport const Match = Vue.defineComponent({\n name: 'Match',\n props: {\n matchId: {\n type: String,\n required: true,\n },\n },\n setup(props) {\n const router = useRouter()\n\n // Derive routeId from initial props.matchId — stable for this component's\n // lifetime. The routeId never changes for a given route position in the\n // tree, even when matchId changes (loaderDepsHash, etc).\n const routeId = router.stores.activeMatchStoresById.get(\n props.matchId,\n )?.routeId\n\n if (!routeId) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `Invariant failed: Could not find routeId for matchId \"${props.matchId}\". Please file an issue!`,\n )\n }\n\n invariant()\n }\n\n // Static route-tree check: is this route a direct child of the root?\n // parentRoute is set at build time, so no reactive tracking needed.\n const isChildOfRoot =\n (router.routesById[routeId] as AnyRoute)?.parentRoute?.id === rootRouteId\n\n // Single stable store subscription — getMatchStoreByRouteId returns a\n // cached computed store that resolves routeId → current match state\n // through the signal graph. No bridge needed.\n const activeMatch = useStore(\n router.stores.getMatchStoreByRouteId(routeId),\n (value) => value,\n )\n const isPendingMatchRef = useStore(\n router.stores.pendingRouteIds,\n (pendingRouteIds) => Boolean(pendingRouteIds[routeId]),\n { equal: Object.is },\n )\n const loadedAt = useStore(router.stores.loadedAt, (value) => value)\n\n const matchData = Vue.computed(() => {\n const match = activeMatch.value\n if (!match) {\n return null\n }\n\n return {\n matchId: match.id,\n routeId,\n loadedAt: loadedAt.value,\n ssr: match.ssr,\n _displayPending: match._displayPending,\n }\n })\n\n const route = Vue.computed(() =>\n matchData.value ? router.routesById[matchData.value.routeId] : null,\n )\n\n const PendingComponent = Vue.computed(\n () =>\n route.value?.options?.pendingComponent ??\n router?.options?.defaultPendingComponent,\n )\n\n const pendingElement = Vue.computed(() =>\n PendingComponent.value ? Vue.h(PendingComponent.value) : undefined,\n )\n\n const routeErrorComponent = Vue.computed(\n () =>\n route.value?.options?.errorComponent ??\n router?.options?.defaultErrorComponent,\n )\n\n const routeOnCatch = Vue.computed(\n () => route.value?.options?.onCatch ?? router?.options?.defaultOnCatch,\n )\n\n const routeNotFoundComponent = Vue.computed(() =>\n route.value?.isRoot\n ? // If it's the root route, use the globalNotFound option, with fallback to the notFoundRoute's component\n (route.value?.options?.notFoundComponent ??\n router?.options?.notFoundRoute?.options?.component)\n : route.value?.options?.notFoundComponent,\n )\n\n const hasShellComponent = Vue.computed(() => {\n if (!route.value?.isRoot) return false\n return !!(route.value.options as RootRouteOptions).shellComponent\n })\n\n const ShellComponent = Vue.computed(() =>\n hasShellComponent.value\n ? ((route.value!.options as RootRouteOptions).shellComponent as any)\n : null,\n )\n\n // Provide routeId context (stable string) for children.\n // MatchInner, Outlet, and useMatch all consume this.\n Vue.provide(routeIdContext, routeId)\n\n // Provide reactive nearest-match context for hooks that slice the active\n // matches array relative to the current match.\n const matchIdRef = Vue.computed(\n () => activeMatch.value?.id ?? props.matchId,\n )\n Vue.provide(matchContext, matchIdRef)\n\n Vue.provide(pendingMatchContext, isPendingMatchRef)\n\n return (): VNode => {\n const actualMatchId = matchData.value?.matchId ?? props.matchId\n\n const resolvedNoSsr =\n matchData.value?.ssr === false || matchData.value?.ssr === 'data-only'\n const shouldClientOnly =\n resolvedNoSsr || !!matchData.value?._displayPending\n\n const renderMatchContent = (): VNode => {\n const matchInner = Vue.h(MatchInner, { matchId: actualMatchId })\n\n let content: VNode = shouldClientOnly\n ? Vue.h(\n ClientOnly,\n {\n fallback: pendingElement.value,\n },\n {\n default: () => matchInner,\n },\n )\n : matchInner\n\n // Wrap in NotFound boundary if needed\n if (routeNotFoundComponent.value) {\n content = Vue.h(CatchNotFound, {\n fallback: (error: any) => {\n // If the current not found handler doesn't exist or it has a\n // route ID which doesn't match the current route, rethrow the error\n if (\n !routeNotFoundComponent.value ||\n (error.routeId && error.routeId !== matchData.value?.routeId) ||\n (!error.routeId && route.value && !route.value.isRoot)\n )\n throw error\n\n return Vue.h(routeNotFoundComponent.value, error)\n },\n children: content,\n })\n }\n\n // Wrap in error boundary if needed\n if (routeErrorComponent.value) {\n content = CatchBoundary({\n getResetKey: () => matchData.value?.loadedAt ?? 0,\n errorComponent: routeErrorComponent.value || ErrorComponent,\n onCatch: (error: Error) => {\n // Forward not found errors (we don't want to show the error component for these)\n if (isNotFound(error)) throw error\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Warning: Error in route match: ${actualMatchId}`)\n }\n routeOnCatch.value?.(error)\n },\n children: content,\n })\n }\n\n // Add scroll restoration if needed\n const withScrollRestoration: Array<VNode> = [\n content,\n isChildOfRoot\n ? Vue.h(Vue.Fragment, null, [\n Vue.h(OnRendered),\n router.options.scrollRestoration &&\n (isServer ?? router.isServer)\n ? Vue.h(ScrollRestoration)\n : null,\n ])\n : null,\n ].filter(Boolean) as Array<VNode>\n\n // Return single child directly to avoid Fragment wrapper that causes hydration mismatch\n if (withScrollRestoration.length === 1) {\n return withScrollRestoration[0]!\n }\n\n return Vue.h(Vue.Fragment, null, withScrollRestoration)\n }\n\n if (!hasShellComponent.value) {\n return renderMatchContent()\n }\n\n return Vue.h(ShellComponent.value, null, {\n // Important: return a fresh VNode on each slot invocation so that shell\n // components can re-render without reusing a cached VNode instance.\n default: () => renderMatchContent(),\n })\n }\n },\n})\n\n// On Rendered can't happen above the root layout because it actually\n// renders a dummy dom element to track the rendered state of the app.\n// We render a script tag with a key that changes based on the current\n// location state.__TSR_key. Also, because it's below the root layout, it\n// allows us to fire onRendered events even after a hydration mismatch\n// error that occurred above the root layout (like bad head/link tags,\n// which is common).\nconst OnRendered = Vue.defineComponent({\n name: 'OnRendered',\n setup() {\n const router = useRouter()\n\n const location = useStore(\n router.stores.resolvedLocation,\n (resolvedLocation) => resolvedLocation?.state.__TSR_key,\n )\n\n let prevHref: string | undefined\n\n Vue.watch(\n location,\n () => {\n if (location.value) {\n const currentHref = router.latestLocation.href\n if (prevHref === undefined || prevHref !== currentHref) {\n router.emit({\n type: 'onRendered',\n ...getLocationChangeInfo(\n router.stores.location.state,\n router.stores.resolvedLocation.state,\n ),\n })\n prevHref = currentHref\n }\n }\n },\n { immediate: true },\n )\n\n return () => null\n },\n})\n\nexport const MatchInner = Vue.defineComponent({\n name: 'MatchInner',\n props: {\n matchId: {\n type: String,\n required: true,\n },\n },\n setup(props) {\n const router = useRouter()\n\n // Use routeId from context (provided by parent Match) — stable string.\n const routeId = Vue.inject(routeIdContext)!\n const activeMatch = useStore(\n router.stores.getMatchStoreByRouteId(routeId),\n (value) => value,\n )\n\n // Combined selector for match state AND remount key\n // This ensures both are computed in the same selector call with consistent data\n const combinedState = Vue.computed(() => {\n const match = activeMatch.value\n if (!match) {\n // Route no longer exists - truly navigating away\n return null\n }\n\n const matchRouteId = match.routeId as string\n\n // Compute remount key\n const remountFn =\n (router.routesById[matchRouteId] as AnyRoute).options.remountDeps ??\n router.options.defaultRemountDeps\n\n let remountKey: string | undefined\n if (remountFn) {\n const remountDeps = remountFn({\n routeId: matchRouteId,\n loaderDeps: match.loaderDeps,\n params: match._strictParams,\n search: match._strictSearch,\n })\n remountKey = remountDeps ? JSON.stringify(remountDeps) : undefined\n }\n\n return {\n routeId: matchRouteId,\n match: {\n id: match.id,\n status: match.status,\n error: match.error,\n ssr: match.ssr,\n _forcePending: match._forcePending,\n _displayPending: match._displayPending,\n },\n remountKey,\n }\n })\n\n const route = Vue.computed(() => {\n if (!combinedState.value) return null\n return router.routesById[combinedState.value.routeId]!\n })\n\n const match = Vue.computed(() => combinedState.value?.match)\n const remountKey = Vue.computed(() => combinedState.value?.remountKey)\n\n return (): VNode | null => {\n // If match doesn't exist, return null (component is being unmounted or not ready)\n if (!combinedState.value || !match.value || !route.value) return null\n\n // Handle different match statuses\n if (match.value._displayPending) {\n const PendingComponent =\n route.value.options.pendingComponent ??\n router.options.defaultPendingComponent\n\n return PendingComponent ? Vue.h(PendingComponent) : null\n }\n\n if (match.value._forcePending) {\n const PendingComponent =\n route.value.options.pendingComponent ??\n router.options.defaultPendingComponent\n\n return PendingComponent ? Vue.h(PendingComponent) : null\n }\n\n if (match.value.status === 'notFound') {\n if (!isNotFound(match.value.error)) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Invariant failed: Expected a notFound error')\n }\n\n invariant()\n }\n return renderRouteNotFound(router, route.value, match.value.error)\n }\n\n if (match.value.status === 'redirected') {\n if (!isRedirect(match.value.error)) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Invariant failed: Expected a redirect error')\n }\n\n invariant()\n }\n throw router.getMatch(match.value.id)?._nonReactive.loadPromise\n }\n\n if (match.value.status === 'error') {\n // Check if this route or any parent has an error component\n const RouteErrorComponent =\n route.value.options.errorComponent ??\n router.options.defaultErrorComponent\n\n // If this route has an error component, render it directly\n // This is more reliable than relying on Vue's error boundary\n if (RouteErrorComponent) {\n return Vue.h(RouteErrorComponent, {\n error: match.value.error,\n reset: () => {\n router.invalidate()\n },\n info: {\n componentStack: '',\n },\n })\n }\n\n // If there's no error component for this route, throw the error\n // so it can bubble up to the nearest parent with an error component\n throw match.value.error\n }\n\n if (match.value.status === 'pending') {\n const pendingMinMs =\n route.value.options.pendingMinMs ?? router.options.defaultPendingMinMs\n\n const routerMatch = router.getMatch(match.value.id)\n if (\n pendingMinMs &&\n routerMatch &&\n !routerMatch._nonReactive.minPendingPromise\n ) {\n // Create a promise that will resolve after the minPendingMs\n if (!(isServer ?? router.isServer)) {\n const minPendingPromise = createControlledPromise<void>()\n\n routerMatch._nonReactive.minPendingPromise = minPendingPromise\n\n setTimeout(() => {\n minPendingPromise.resolve()\n // We've handled the minPendingPromise, so we can delete it\n routerMatch._nonReactive.minPendingPromise = undefined\n }, pendingMinMs)\n }\n }\n\n // In Vue, we render the pending component directly instead of throwing a promise\n // because Vue's Suspense doesn't catch thrown promises like React does\n const PendingComponent =\n route.value.options.pendingComponent ??\n router.options.defaultPendingComponent\n\n if (PendingComponent) {\n return Vue.h(PendingComponent)\n }\n\n // If no pending component, return null while loading\n return null\n }\n\n // Success status - render the component with remount key\n const Comp =\n route.value.options.component ?? router.options.defaultComponent\n const key = remountKey.value\n\n if (Comp) {\n // Pass key as a prop - Vue.h properly handles 'key' as a special prop\n return Vue.h(Comp, key !== undefined ? { key } : undefined)\n }\n\n return Vue.h(Outlet, key !== undefined ? { key } : undefined)\n }\n },\n})\n\nexport const Outlet = Vue.defineComponent({\n name: 'Outlet',\n setup() {\n const router = useRouter()\n const parentRouteId = Vue.inject(routeIdContext)\n\n if (!parentRouteId) {\n return (): VNode | null => null\n }\n\n // Parent state via stable routeId store — single subscription\n const parentMatch = useStore(\n router.stores.getMatchStoreByRouteId(parentRouteId),\n (v) => v,\n )\n\n const route = Vue.computed(() =>\n parentMatch.value\n ? router.routesById[parentMatch.value.routeId as string]!\n : undefined,\n )\n\n const parentGlobalNotFound = Vue.computed(\n () => parentMatch.value?.globalNotFound ?? false,\n )\n\n // Child match lookup: read the child matchId from the shared derived\n // map (one reactive node for the whole tree), then grab match state\n // directly from the pool.\n const childMatchIdMap = useStore(\n router.stores.childMatchIdByRouteId,\n (v) => v,\n )\n\n const childMatchData = Vue.computed(() => {\n const childId = childMatchIdMap.value[parentRouteId]\n if (!childId) return null\n const child = router.stores.activeMatchStoresById.get(childId)?.state\n if (!child) return null\n\n return {\n id: child.id,\n // Key based on routeId + params only (not loaderDeps)\n // This ensures component recreates when params change,\n // but NOT when only loaderDeps change\n paramsKey: child.routeId + JSON.stringify(child._strictParams),\n }\n })\n\n return (): VNode | null => {\n if (parentGlobalNotFound.value) {\n if (!route.value) {\n return null\n }\n return renderRouteNotFound(router, route.value, undefined)\n }\n\n if (!childMatchData.value) {\n return null\n }\n\n const nextMatch = Vue.h(Match, {\n matchId: childMatchData.value.id,\n key: childMatchData.value.paramsKey,\n })\n\n // Note: We intentionally do NOT wrap in Suspense here.\n // The top-level Suspense in Matches already covers the root.\n // The old code compared matchId (e.g. \"__root__/\") with rootRouteId (\"__root__\")\n // which never matched, so this Suspense was effectively dead code.\n // With routeId-based lookup, parentRouteId === rootRouteId would match,\n // causing a double-Suspense that corrupts Vue's DOM during updates.\n return nextMatch\n }\n },\n})\n"],"mappings":";;;;;;;;;;;;AAyBA,IAAamB,QAAQnB,IAAIoB,gBAAgB;CACvCC,MAAM;CACNC,OAAO,EACLC,SAAS;EACPC,MAAMC;EACNC,UAAU;EACZ,EACD;CACDC,MAAML,OAAO;EACX,MAAMM,SAAShB,WAAW;EAK1B,MAAMiB,UAAUD,OAAOE,OAAOC,sBAAsBC,IAClDV,MAAMC,QACP,EAAEM;AAEH,MAAI,CAACA,SAAS;AACZ,OAAA,QAAA,IAAA,aAA6B,aAC3B,OAAM,IAAIO,MACR,yDAAyDd,MAAMC,QAAO,0BACvE;AAGHpB,cAAW;;EAKb,MAAMkC,gBACHT,OAAOU,WAAWT,UAAuBU,aAAaC,OAAOlC;EAKhE,MAAMmC,cAAcjC,SAClBoB,OAAOE,OAAOY,uBAAuBb,QAAQ,GAC5Cc,UAAUA,MACZ;EACD,MAAMC,oBAAoBpC,SACxBoB,OAAOE,OAAOe,kBACbA,oBAAoBC,QAAQD,gBAAgBhB,SAAS,EACtD,EAAEkB,OAAOC,OAAOC,IAClB,CAAC;EACD,MAAMC,WAAW1C,SAASoB,OAAOE,OAAOoB,WAAWP,UAAUA,MAAM;EAEnE,MAAMQ,YAAYnD,IAAIoD,eAAe;GACnC,MAAMC,QAAQZ,YAAYE;AAC1B,OAAI,CAACU,MACH,QAAO;AAGT,UAAO;IACL9B,SAAS8B,MAAMb;IACfX;IACAqB,UAAUA,SAASP;IACnBW,KAAKD,MAAMC;IACXC,iBAAiBF,MAAME;IACxB;IACD;EAEF,MAAMC,QAAQxD,IAAIoD,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oBW,QAAQ4B,MAAMb,OAAOoB,KAAAA,EAAU;;AAG5D,OAAI,CAACyF,eAAe7G,MAClB,QAAO;AAcT,UAXkB3C,IAAI8D,EAAE3C,OAAO;IAC7BI,SAASiI,eAAe7G,MAAMH;IAC9BuG,KAAKS,eAAe7G,MAAMgH;IAC3B,CAAC;;;CAWP,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useRouter } from "./useRouter.js";
|
|
2
|
-
import {
|
|
2
|
+
import { getElementScrollRestorationEntry, setupScrollRestoration } from "@tanstack/router-core";
|
|
3
3
|
//#region src/ScrollRestoration.tsx
|
|
4
4
|
function useScrollRestoration() {
|
|
5
5
|
setupScrollRestoration(useRouter(), true);
|
|
@@ -14,17 +14,7 @@ function ScrollRestoration(_props) {
|
|
|
14
14
|
}
|
|
15
15
|
function useElementScrollRestoration(options) {
|
|
16
16
|
useScrollRestoration();
|
|
17
|
-
|
|
18
|
-
const getKey = options.getKey || defaultGetScrollRestorationKey;
|
|
19
|
-
let elementSelector = "";
|
|
20
|
-
if (options.id) elementSelector = `[data-scroll-restoration-id="${options.id}"]`;
|
|
21
|
-
else {
|
|
22
|
-
const element = options.getElement?.();
|
|
23
|
-
if (!element) return;
|
|
24
|
-
elementSelector = element instanceof Window ? "window" : getCssSelector(element);
|
|
25
|
-
}
|
|
26
|
-
const restoreKey = getKey(router.latestLocation);
|
|
27
|
-
return (scrollRestorationCache?.state[restoreKey])?.[elementSelector];
|
|
17
|
+
return getElementScrollRestorationEntry(useRouter(), options);
|
|
28
18
|
}
|
|
29
19
|
//#endregion
|
|
30
20
|
export { ScrollRestoration, useElementScrollRestoration };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollRestoration.js","names":["
|
|
1
|
+
{"version":3,"file":"ScrollRestoration.js","names":["getElementScrollRestorationEntry","setupScrollRestoration","useRouter","useScrollRestoration","router","ScrollRestoration","_props","process","env","NODE_ENV","console","warn","useElementScrollRestoration","options"],"sources":["../../src/ScrollRestoration.tsx"],"sourcesContent":["import {\n getElementScrollRestorationEntry,\n setupScrollRestoration,\n} from '@tanstack/router-core'\nimport { useRouter } from './useRouter'\nimport type {\n ParsedLocation,\n ScrollRestorationEntry,\n ScrollRestorationOptions,\n} from '@tanstack/router-core'\n\nfunction useScrollRestoration() {\n const router = useRouter()\n setupScrollRestoration(router, true)\n}\n\n/**\n * @deprecated use createRouter's `scrollRestoration` option instead\n */\nexport function ScrollRestoration(_props: ScrollRestorationOptions) {\n useScrollRestoration()\n\n if (process.env.NODE_ENV === 'development') {\n console.warn(\n \"The ScrollRestoration component is deprecated. Use createRouter's `scrollRestoration` option instead.\",\n )\n }\n\n return null\n}\n\nexport function useElementScrollRestoration(\n options: (\n | {\n id: string\n getElement?: () => Window | Element | undefined | null\n }\n | {\n id?: string\n getElement: () => Window | Element | undefined | null\n }\n ) & {\n getKey?: (location: ParsedLocation) => string\n },\n): ScrollRestorationEntry | undefined {\n useScrollRestoration()\n\n return getElementScrollRestorationEntry(useRouter(), options)\n}\n"],"mappings":";;;AAWA,SAASG,uBAAuB;AAE9BF,wBADeC,WAAW,EACK,KAAK;;;;;AAMtC,SAAgBG,kBAAkBC,QAAkC;AAClEH,uBAAsB;AAEtB,KAAA,QAAA,IAAA,aAA6B,cAC3BO,SAAQC,KACN,wGACD;AAGH,QAAO;;AAGT,SAAgBC,4BACdC,SAYoC;AACpCV,uBAAsB;AAEtB,QAAOH,iCAAiCE,WAAW,EAAEW,QAAQ"}
|
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
import * as Vue from 'vue';
|
|
2
|
-
/**
|
|
3
|
-
* ScrollRestoration component for Vue.
|
|
4
|
-
* On server: renders a ScriptOnce with scroll restoration logic.
|
|
5
|
-
* On client during hydration: renders a matching ScriptOnce to avoid mismatch.
|
|
6
|
-
* After mount: renders nothing.
|
|
7
|
-
*/
|
|
8
2
|
export declare const ScrollRestoration: Vue.DefineComponent<{}, () => import("vue/jsx-runtime").JSX.Element | null, {}, {}, {}, Vue.ComponentOptionsMixin, Vue.ComponentOptionsMixin, {}, string, Vue.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, Vue.ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,39 +1,17 @@
|
|
|
1
1
|
import { useRouter } from "./useRouter.js";
|
|
2
2
|
import { ScriptOnce } from "./ScriptOnce.js";
|
|
3
|
-
import { defaultGetScrollRestorationKey, escapeHtml, restoreScroll, storageKey } from "@tanstack/router-core";
|
|
4
3
|
import * as Vue from "vue";
|
|
5
4
|
import { createVNode } from "vue";
|
|
6
|
-
import {
|
|
5
|
+
import { getScrollRestorationScriptForRouter } from "@tanstack/router-core/scroll-restoration-script";
|
|
7
6
|
//#region src/scroll-restoration.tsx
|
|
8
|
-
/**
|
|
9
|
-
* ScrollRestoration component for Vue.
|
|
10
|
-
* On server: renders a ScriptOnce with scroll restoration logic.
|
|
11
|
-
* On client during hydration: renders a matching ScriptOnce to avoid mismatch.
|
|
12
|
-
* After mount: renders nothing.
|
|
13
|
-
*/
|
|
14
7
|
var ScrollRestoration = Vue.defineComponent({
|
|
15
8
|
name: "ScrollRestoration",
|
|
16
9
|
setup() {
|
|
17
10
|
const router = useRouter();
|
|
18
|
-
const mounted = Vue.ref(false);
|
|
19
|
-
Vue.onMounted(() => {
|
|
20
|
-
mounted.value = true;
|
|
21
|
-
});
|
|
22
11
|
return () => {
|
|
23
|
-
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
if (!router.options.scrollRestoration({ location: router.latestLocation })) return null;
|
|
27
|
-
}
|
|
28
|
-
const userKey = (router.options.getScrollRestorationKey || defaultGetScrollRestorationKey)(router.latestLocation);
|
|
29
|
-
const resolvedKey = userKey !== defaultGetScrollRestorationKey(router.latestLocation) ? userKey : void 0;
|
|
30
|
-
const restoreScrollOptions = {
|
|
31
|
-
storageKey,
|
|
32
|
-
shouldScrollRestoration: true
|
|
33
|
-
};
|
|
34
|
-
if (resolvedKey) restoreScrollOptions.key = resolvedKey;
|
|
35
|
-
if (isServer ?? router.isServer) return createVNode(ScriptOnce, { "children": `(${restoreScroll.toString()})(${escapeHtml(JSON.stringify(restoreScrollOptions))})` }, null);
|
|
36
|
-
return createVNode(ScriptOnce, { "children": "" }, null);
|
|
12
|
+
const script = getScrollRestorationScriptForRouter(router);
|
|
13
|
+
if (script) return createVNode(ScriptOnce, { "children": script }, null);
|
|
14
|
+
return null;
|
|
37
15
|
};
|
|
38
16
|
}
|
|
39
17
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroll-restoration.js","names":["Vue","
|
|
1
|
+
{"version":3,"file":"scroll-restoration.js","names":["Vue","getScrollRestorationScriptForRouter","useRouter","ScriptOnce","ScrollRestoration","defineComponent","name","setup","router","script","_createVNode"],"sources":["../../src/scroll-restoration.tsx"],"sourcesContent":["import * as Vue from 'vue'\nimport { getScrollRestorationScriptForRouter } from '@tanstack/router-core/scroll-restoration-script'\nimport { useRouter } from './useRouter'\nimport { ScriptOnce } from './ScriptOnce'\n\nexport const ScrollRestoration = Vue.defineComponent({\n name: 'ScrollRestoration',\n setup() {\n const router = useRouter()\n\n return () => {\n const script = getScrollRestorationScriptForRouter(router)\n\n if (script) {\n return <ScriptOnce children={script} />\n }\n\n return null\n }\n },\n})\n"],"mappings":";;;;;;AAKA,IAAaI,oBAAoBJ,IAAIK,gBAAgB;CACnDC,MAAM;CACNC,QAAQ;EACN,MAAMC,SAASN,WAAW;AAE1B,eAAa;GACX,MAAMO,SAASR,oCAAoCO,OAAO;AAE1D,OAAIC,OACF,QAAAC,YAAAP,YAAA,EAAA,YAA6BM,QAAM,EAAA,KAAA;AAGrC,UAAO;;;CAGZ,CAAC"}
|
package/dist/source/Match.jsx
CHANGED
|
@@ -127,10 +127,13 @@ export const Match = Vue.defineComponent({
|
|
|
127
127
|
// Add scroll restoration if needed
|
|
128
128
|
const withScrollRestoration = [
|
|
129
129
|
content,
|
|
130
|
-
isChildOfRoot
|
|
130
|
+
isChildOfRoot
|
|
131
131
|
? Vue.h(Vue.Fragment, null, [
|
|
132
132
|
Vue.h(OnRendered),
|
|
133
|
-
|
|
133
|
+
router.options.scrollRestoration &&
|
|
134
|
+
(isServer ?? router.isServer)
|
|
135
|
+
? Vue.h(ScrollRestoration)
|
|
136
|
+
: null,
|
|
134
137
|
])
|
|
135
138
|
: null,
|
|
136
139
|
].filter(Boolean);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Match.jsx","sourceRoot":"","sources":["../../src/Match.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAA;AAC1B,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,SAAS,EACT,UAAU,EACV,UAAU,EACV,WAAW,GACZ,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAA;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,cAAc,GACf,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAIxD,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAC,eAAe,CAAC;IACvC,IAAI,EAAE,OAAO;IACb,KAAK,EAAE;QACL,OAAO,EAAE;YACP,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,IAAI;SACf;KACF;IACD,KAAK,CAAC,KAAK;QACT,MAAM,MAAM,GAAG,SAAS,EA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AAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,KAAK,CAAA;YACrE,IAAI,CAAC,KAAK;gBAAE,OAAO,IAAI,CAAA;YAEvB,OAAO;gBACL,EAAE,EAAE,KAAK,CAAC,EAAE;gBACZ,sDAAsD;gBACtD,uDAAuD;gBACvD,sCAAsC;gBACtC,SAAS,EAAE,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,aAAa,CAAC;aAC/D,CAAA;QACH,CAAC,CAAC,CAAA;QAEF,OAAO,GAAiB,EAAE;YACxB,IAAI,oBAAoB,CAAC,KAAK,EAAE,CAAC;gBAC/B,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;oBACjB,OAAO,IAAI,CAAA;gBACb,CAAC;gBACD,OAAO,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;YAC5D,CAAC;YAED,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;gBAC1B,OAAO,IAAI,CAAA;YACb,CAAC;YAED,MAAM,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE;gBAC7B,OAAO,EAAE,cAAc,CAAC,KAAK,CAAC,EAAE;gBAChC,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC,SAAS;aACpC,CAAC,CAAA;YAEF,uDAAuD;YACvD,6DAA6D;YAC7D,iFAAiF;YACjF,mEAAmE;YACnE,wEAAwE;YACxE,oEAAoE;YACpE,OAAO,SAAS,CAAA;QAClB,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getElementScrollRestorationEntry, setupScrollRestoration, } from '@tanstack/router-core';
|
|
2
2
|
import { useRouter } from './useRouter';
|
|
3
3
|
function useScrollRestoration() {
|
|
4
4
|
const router = useRouter();
|
|
@@ -16,22 +16,6 @@ export function ScrollRestoration(_props) {
|
|
|
16
16
|
}
|
|
17
17
|
export function useElementScrollRestoration(options) {
|
|
18
18
|
useScrollRestoration();
|
|
19
|
-
|
|
20
|
-
const getKey = options.getKey || defaultGetScrollRestorationKey;
|
|
21
|
-
let elementSelector = '';
|
|
22
|
-
if (options.id) {
|
|
23
|
-
elementSelector = `[data-scroll-restoration-id="${options.id}"]`;
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
const element = options.getElement?.();
|
|
27
|
-
if (!element) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
elementSelector =
|
|
31
|
-
element instanceof Window ? 'window' : getCssSelector(element);
|
|
32
|
-
}
|
|
33
|
-
const restoreKey = getKey(router.latestLocation);
|
|
34
|
-
const byKey = scrollRestorationCache?.state[restoreKey];
|
|
35
|
-
return byKey?.[elementSelector];
|
|
19
|
+
return getElementScrollRestorationEntry(useRouter(), options);
|
|
36
20
|
}
|
|
37
21
|
//# sourceMappingURL=ScrollRestoration.jsx.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollRestoration.jsx","sourceRoot":"","sources":["../../src/ScrollRestoration.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"ScrollRestoration.jsx","sourceRoot":"","sources":["../../src/ScrollRestoration.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,sBAAsB,GACvB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAOvC,SAAS,oBAAoB;IAC3B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,sBAAsB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;AACtC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAgC;IAChE,oBAAoB,EAAE,CAAA;IAEtB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE,CAAC;QAC3C,OAAO,CAAC,IAAI,CACV,uGAAuG,CACxG,CAAA;IACH,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,OAWC;IAED,oBAAoB,EAAE,CAAA;IAEtB,OAAO,gCAAgC,CAAC,SAAS,EAAE,EAAE,OAAO,CAAC,CAAA;AAC/D,CAAC"}
|
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
import * as Vue from 'vue';
|
|
2
|
-
/**
|
|
3
|
-
* ScrollRestoration component for Vue.
|
|
4
|
-
* On server: renders a ScriptOnce with scroll restoration logic.
|
|
5
|
-
* On client during hydration: renders a matching ScriptOnce to avoid mismatch.
|
|
6
|
-
* After mount: renders nothing.
|
|
7
|
-
*/
|
|
8
2
|
export declare const ScrollRestoration: Vue.DefineComponent<{}, () => import("vue/jsx-runtime").JSX.Element | null, {}, {}, {}, Vue.ComponentOptionsMixin, Vue.ComponentOptionsMixin, {}, string, Vue.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, Vue.ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,59 +1,17 @@
|
|
|
1
1
|
import * as Vue from 'vue';
|
|
2
|
-
import {
|
|
3
|
-
import { isServer } from '@tanstack/router-core/isServer';
|
|
2
|
+
import { getScrollRestorationScriptForRouter } from '@tanstack/router-core/scroll-restoration-script';
|
|
4
3
|
import { useRouter } from './useRouter';
|
|
5
4
|
import { ScriptOnce } from './ScriptOnce';
|
|
6
|
-
/**
|
|
7
|
-
* ScrollRestoration component for Vue.
|
|
8
|
-
* On server: renders a ScriptOnce with scroll restoration logic.
|
|
9
|
-
* On client during hydration: renders a matching ScriptOnce to avoid mismatch.
|
|
10
|
-
* After mount: renders nothing.
|
|
11
|
-
*/
|
|
12
5
|
export const ScrollRestoration = Vue.defineComponent({
|
|
13
6
|
name: 'ScrollRestoration',
|
|
14
7
|
setup() {
|
|
15
8
|
const router = useRouter();
|
|
16
|
-
// Track mounted state for hydration handling
|
|
17
|
-
const mounted = Vue.ref(false);
|
|
18
|
-
Vue.onMounted(() => {
|
|
19
|
-
mounted.value = true;
|
|
20
|
-
});
|
|
21
9
|
return () => {
|
|
22
|
-
|
|
23
|
-
if (
|
|
24
|
-
return
|
|
10
|
+
const script = getScrollRestorationScriptForRouter(router);
|
|
11
|
+
if (script) {
|
|
12
|
+
return <ScriptOnce children={script}/>;
|
|
25
13
|
}
|
|
26
|
-
|
|
27
|
-
if (!router.isScrollRestoring) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
// Check custom scroll restoration function
|
|
31
|
-
if (typeof router.options.scrollRestoration === 'function') {
|
|
32
|
-
const shouldRestore = router.options.scrollRestoration({
|
|
33
|
-
location: router.latestLocation,
|
|
34
|
-
});
|
|
35
|
-
if (!shouldRestore) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
const getKey = router.options.getScrollRestorationKey || defaultGetScrollRestorationKey;
|
|
40
|
-
const userKey = getKey(router.latestLocation);
|
|
41
|
-
const resolvedKey = userKey !== defaultGetScrollRestorationKey(router.latestLocation)
|
|
42
|
-
? userKey
|
|
43
|
-
: undefined;
|
|
44
|
-
const restoreScrollOptions = {
|
|
45
|
-
storageKey,
|
|
46
|
-
shouldScrollRestoration: true,
|
|
47
|
-
};
|
|
48
|
-
if (resolvedKey) {
|
|
49
|
-
restoreScrollOptions.key = resolvedKey;
|
|
50
|
-
}
|
|
51
|
-
// Server-side: render the actual scroll restoration script
|
|
52
|
-
if (isServer ?? router.isServer) {
|
|
53
|
-
return (<ScriptOnce children={`(${restoreScroll.toString()})(${escapeHtml(JSON.stringify(restoreScrollOptions))})`}/>);
|
|
54
|
-
}
|
|
55
|
-
// Client-side during hydration: render empty ScriptOnce to match server structure
|
|
56
|
-
return <ScriptOnce children=""/>;
|
|
14
|
+
return null;
|
|
57
15
|
};
|
|
58
16
|
},
|
|
59
17
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroll-restoration.jsx","sourceRoot":"","sources":["../../src/scroll-restoration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAA;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"scroll-restoration.jsx","sourceRoot":"","sources":["../../src/scroll-restoration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,mCAAmC,EAAE,MAAM,iDAAiD,CAAA;AACrG,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC,eAAe,CAAC;IACnD,IAAI,EAAE,mBAAmB;IACzB,KAAK;QACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;QAE1B,OAAO,GAAG,EAAE;YACV,MAAM,MAAM,GAAG,mCAAmC,CAAC,MAAM,CAAC,CAAA;YAE1D,IAAI,MAAM,EAAE,CAAC;gBACX,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAG,CAAA;YACzC,CAAC;YAED,OAAO,IAAI,CAAA;QACb,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/vue-router",
|
|
3
|
-
"version": "1.168.
|
|
3
|
+
"version": "1.168.5",
|
|
4
4
|
"description": "Modern and scalable routing for Vue applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -60,12 +60,12 @@
|
|
|
60
60
|
"node": ">=20.19"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@tanstack/vue-store": "^0.9.
|
|
63
|
+
"@tanstack/vue-store": "^0.9.3",
|
|
64
64
|
"@vue/runtime-dom": "^3.5.25",
|
|
65
65
|
"isbot": "^5.1.22",
|
|
66
66
|
"jsesc": "^3.0.2",
|
|
67
67
|
"@tanstack/history": "1.161.6",
|
|
68
|
-
"@tanstack/router-core": "1.168.
|
|
68
|
+
"@tanstack/router-core": "1.168.5"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@tanstack/intent": "^0.0.14",
|
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
"combinate": "^1.1.11",
|
|
78
78
|
"vite": "*",
|
|
79
79
|
"vue": "^3.5.25",
|
|
80
|
-
"zod": "^3.23.8"
|
|
80
|
+
"zod": "^3.23.8",
|
|
81
|
+
"@types/node": ">=20"
|
|
81
82
|
},
|
|
82
83
|
"peerDependencies": {
|
|
83
84
|
"vue": "^3.3.0"
|
package/src/Match.tsx
CHANGED
|
@@ -203,10 +203,13 @@ export const Match = Vue.defineComponent({
|
|
|
203
203
|
// Add scroll restoration if needed
|
|
204
204
|
const withScrollRestoration: Array<VNode> = [
|
|
205
205
|
content,
|
|
206
|
-
isChildOfRoot
|
|
206
|
+
isChildOfRoot
|
|
207
207
|
? Vue.h(Vue.Fragment, null, [
|
|
208
208
|
Vue.h(OnRendered),
|
|
209
|
-
|
|
209
|
+
router.options.scrollRestoration &&
|
|
210
|
+
(isServer ?? router.isServer)
|
|
211
|
+
? Vue.h(ScrollRestoration)
|
|
212
|
+
: null,
|
|
210
213
|
])
|
|
211
214
|
: null,
|
|
212
215
|
].filter(Boolean) as Array<VNode>
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
getCssSelector,
|
|
4
|
-
scrollRestorationCache,
|
|
2
|
+
getElementScrollRestorationEntry,
|
|
5
3
|
setupScrollRestoration,
|
|
6
4
|
} from '@tanstack/router-core'
|
|
7
5
|
import { useRouter } from './useRouter'
|
|
@@ -47,23 +45,5 @@ export function useElementScrollRestoration(
|
|
|
47
45
|
): ScrollRestorationEntry | undefined {
|
|
48
46
|
useScrollRestoration()
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
const getKey = options.getKey || defaultGetScrollRestorationKey
|
|
52
|
-
|
|
53
|
-
let elementSelector = ''
|
|
54
|
-
|
|
55
|
-
if (options.id) {
|
|
56
|
-
elementSelector = `[data-scroll-restoration-id="${options.id}"]`
|
|
57
|
-
} else {
|
|
58
|
-
const element = options.getElement?.()
|
|
59
|
-
if (!element) {
|
|
60
|
-
return
|
|
61
|
-
}
|
|
62
|
-
elementSelector =
|
|
63
|
-
element instanceof Window ? 'window' : getCssSelector(element)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const restoreKey = getKey(router.latestLocation)
|
|
67
|
-
const byKey = scrollRestorationCache?.state[restoreKey]
|
|
68
|
-
return byKey?.[elementSelector]
|
|
48
|
+
return getElementScrollRestorationEntry(useRouter(), options)
|
|
69
49
|
}
|
|
@@ -1,79 +1,21 @@
|
|
|
1
1
|
import * as Vue from 'vue'
|
|
2
|
-
import {
|
|
3
|
-
defaultGetScrollRestorationKey,
|
|
4
|
-
escapeHtml,
|
|
5
|
-
restoreScroll,
|
|
6
|
-
storageKey,
|
|
7
|
-
} from '@tanstack/router-core'
|
|
8
|
-
import { isServer } from '@tanstack/router-core/isServer'
|
|
2
|
+
import { getScrollRestorationScriptForRouter } from '@tanstack/router-core/scroll-restoration-script'
|
|
9
3
|
import { useRouter } from './useRouter'
|
|
10
4
|
import { ScriptOnce } from './ScriptOnce'
|
|
11
5
|
|
|
12
|
-
/**
|
|
13
|
-
* ScrollRestoration component for Vue.
|
|
14
|
-
* On server: renders a ScriptOnce with scroll restoration logic.
|
|
15
|
-
* On client during hydration: renders a matching ScriptOnce to avoid mismatch.
|
|
16
|
-
* After mount: renders nothing.
|
|
17
|
-
*/
|
|
18
6
|
export const ScrollRestoration = Vue.defineComponent({
|
|
19
7
|
name: 'ScrollRestoration',
|
|
20
8
|
setup() {
|
|
21
9
|
const router = useRouter()
|
|
22
10
|
|
|
23
|
-
// Track mounted state for hydration handling
|
|
24
|
-
const mounted = Vue.ref(false)
|
|
25
|
-
Vue.onMounted(() => {
|
|
26
|
-
mounted.value = true
|
|
27
|
-
})
|
|
28
|
-
|
|
29
11
|
return () => {
|
|
30
|
-
|
|
31
|
-
if (mounted.value) {
|
|
32
|
-
return null
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Check if scroll restoration is enabled
|
|
36
|
-
if (!router.isScrollRestoring) {
|
|
37
|
-
return null
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Check custom scroll restoration function
|
|
41
|
-
if (typeof router.options.scrollRestoration === 'function') {
|
|
42
|
-
const shouldRestore = router.options.scrollRestoration({
|
|
43
|
-
location: router.latestLocation,
|
|
44
|
-
})
|
|
45
|
-
if (!shouldRestore) {
|
|
46
|
-
return null
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const getKey =
|
|
51
|
-
router.options.getScrollRestorationKey || defaultGetScrollRestorationKey
|
|
52
|
-
const userKey = getKey(router.latestLocation)
|
|
53
|
-
const resolvedKey =
|
|
54
|
-
userKey !== defaultGetScrollRestorationKey(router.latestLocation)
|
|
55
|
-
? userKey
|
|
56
|
-
: undefined
|
|
57
|
-
|
|
58
|
-
const restoreScrollOptions: Parameters<typeof restoreScroll>[0] = {
|
|
59
|
-
storageKey,
|
|
60
|
-
shouldScrollRestoration: true,
|
|
61
|
-
}
|
|
62
|
-
if (resolvedKey) {
|
|
63
|
-
restoreScrollOptions.key = resolvedKey
|
|
64
|
-
}
|
|
12
|
+
const script = getScrollRestorationScriptForRouter(router)
|
|
65
13
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<ScriptOnce
|
|
70
|
-
children={`(${restoreScroll.toString()})(${escapeHtml(JSON.stringify(restoreScrollOptions))})`}
|
|
71
|
-
/>
|
|
72
|
-
)
|
|
14
|
+
if (script) {
|
|
15
|
+
return <ScriptOnce children={script} />
|
|
73
16
|
}
|
|
74
17
|
|
|
75
|
-
|
|
76
|
-
return <ScriptOnce children="" />
|
|
18
|
+
return null
|
|
77
19
|
}
|
|
78
20
|
},
|
|
79
21
|
})
|