@tanstack/react-router 1.130.0 → 1.130.1
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.
|
@@ -8,14 +8,21 @@ function ScrollRestoration() {
|
|
|
8
8
|
const router = useRouter.useRouter();
|
|
9
9
|
const getKey = router.options.getScrollRestorationKey || routerCore.defaultGetScrollRestorationKey;
|
|
10
10
|
const userKey = getKey(router.latestLocation);
|
|
11
|
-
const resolvedKey = userKey !== routerCore.defaultGetScrollRestorationKey(router.latestLocation) ? userKey :
|
|
11
|
+
const resolvedKey = userKey !== routerCore.defaultGetScrollRestorationKey(router.latestLocation) ? userKey : void 0;
|
|
12
12
|
if (!router.isScrollRestoring || !router.isServer) {
|
|
13
13
|
return null;
|
|
14
14
|
}
|
|
15
|
+
const restoreScrollOptions = {
|
|
16
|
+
storageKey: routerCore.storageKey,
|
|
17
|
+
shouldScrollRestoration: true
|
|
18
|
+
};
|
|
19
|
+
if (resolvedKey) {
|
|
20
|
+
restoreScrollOptions.key = resolvedKey;
|
|
21
|
+
}
|
|
15
22
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
16
23
|
ScriptOnce.ScriptOnce,
|
|
17
24
|
{
|
|
18
|
-
children: `(${routerCore.restoreScroll.toString()})(${JSON.stringify(
|
|
25
|
+
children: `(${routerCore.restoreScroll.toString()})(${JSON.stringify(restoreScrollOptions)})`
|
|
19
26
|
}
|
|
20
27
|
);
|
|
21
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroll-restoration.cjs","sources":["../../src/scroll-restoration.tsx"],"sourcesContent":["import {\n defaultGetScrollRestorationKey,\n restoreScroll,\n storageKey,\n} from '@tanstack/router-core'\nimport { useRouter } from './useRouter'\nimport { ScriptOnce } from './ScriptOnce'\n\nexport function ScrollRestoration() {\n const router = useRouter()\n const getKey =\n router.options.getScrollRestorationKey || defaultGetScrollRestorationKey\n const userKey = getKey(router.latestLocation)\n const resolvedKey =\n userKey !== defaultGetScrollRestorationKey(router.latestLocation)\n ? userKey\n :
|
|
1
|
+
{"version":3,"file":"scroll-restoration.cjs","sources":["../../src/scroll-restoration.tsx"],"sourcesContent":["import {\n defaultGetScrollRestorationKey,\n restoreScroll,\n storageKey,\n} from '@tanstack/router-core'\nimport { useRouter } from './useRouter'\nimport { ScriptOnce } from './ScriptOnce'\n\nexport function ScrollRestoration() {\n const router = useRouter()\n const getKey =\n router.options.getScrollRestorationKey || defaultGetScrollRestorationKey\n const userKey = getKey(router.latestLocation)\n const resolvedKey =\n userKey !== defaultGetScrollRestorationKey(router.latestLocation)\n ? userKey\n : undefined\n\n if (!router.isScrollRestoring || !router.isServer) {\n return null\n }\n\n const restoreScrollOptions: Parameters<typeof restoreScroll>[0] = {\n storageKey,\n shouldScrollRestoration: true,\n }\n if (resolvedKey) {\n restoreScrollOptions.key = resolvedKey\n }\n\n return (\n <ScriptOnce\n children={`(${restoreScroll.toString()})(${JSON.stringify(restoreScrollOptions)})`}\n />\n )\n}\n"],"names":["useRouter","defaultGetScrollRestorationKey","storageKey","jsx","ScriptOnce","restoreScroll"],"mappings":";;;;;;AAQO,SAAS,oBAAoB;AAClC,QAAM,SAASA,UAAAA,UAAU;AACnB,QAAA,SACJ,OAAO,QAAQ,2BAA2BC,WAAA;AACtC,QAAA,UAAU,OAAO,OAAO,cAAc;AAC5C,QAAM,cACJ,YAAYA,WAAA,+BAA+B,OAAO,cAAc,IAC5D,UACA;AAEN,MAAI,CAAC,OAAO,qBAAqB,CAAC,OAAO,UAAU;AAC1C,WAAA;AAAA,EAAA;AAGT,QAAM,uBAA4D;AAAA,IAAA,YAChEC,WAAA;AAAA,IACA,yBAAyB;AAAA,EAC3B;AACA,MAAI,aAAa;AACf,yBAAqB,MAAM;AAAA,EAAA;AAI3B,SAAAC,2BAAA;AAAA,IAACC,WAAA;AAAA,IAAA;AAAA,MACC,UAAU,IAAIC,WAAAA,cAAc,SAAA,CAAU,KAAK,KAAK,UAAU,oBAAoB,CAAC;AAAA,IAAA;AAAA,EACjF;AAEJ;;"}
|
|
@@ -6,14 +6,21 @@ function ScrollRestoration() {
|
|
|
6
6
|
const router = useRouter();
|
|
7
7
|
const getKey = router.options.getScrollRestorationKey || defaultGetScrollRestorationKey;
|
|
8
8
|
const userKey = getKey(router.latestLocation);
|
|
9
|
-
const resolvedKey = userKey !== defaultGetScrollRestorationKey(router.latestLocation) ? userKey :
|
|
9
|
+
const resolvedKey = userKey !== defaultGetScrollRestorationKey(router.latestLocation) ? userKey : void 0;
|
|
10
10
|
if (!router.isScrollRestoring || !router.isServer) {
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
13
|
+
const restoreScrollOptions = {
|
|
14
|
+
storageKey,
|
|
15
|
+
shouldScrollRestoration: true
|
|
16
|
+
};
|
|
17
|
+
if (resolvedKey) {
|
|
18
|
+
restoreScrollOptions.key = resolvedKey;
|
|
19
|
+
}
|
|
13
20
|
return /* @__PURE__ */ jsx(
|
|
14
21
|
ScriptOnce,
|
|
15
22
|
{
|
|
16
|
-
children: `(${restoreScroll.toString()})(${JSON.stringify(
|
|
23
|
+
children: `(${restoreScroll.toString()})(${JSON.stringify(restoreScrollOptions)})`
|
|
17
24
|
}
|
|
18
25
|
);
|
|
19
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroll-restoration.js","sources":["../../src/scroll-restoration.tsx"],"sourcesContent":["import {\n defaultGetScrollRestorationKey,\n restoreScroll,\n storageKey,\n} from '@tanstack/router-core'\nimport { useRouter } from './useRouter'\nimport { ScriptOnce } from './ScriptOnce'\n\nexport function ScrollRestoration() {\n const router = useRouter()\n const getKey =\n router.options.getScrollRestorationKey || defaultGetScrollRestorationKey\n const userKey = getKey(router.latestLocation)\n const resolvedKey =\n userKey !== defaultGetScrollRestorationKey(router.latestLocation)\n ? userKey\n :
|
|
1
|
+
{"version":3,"file":"scroll-restoration.js","sources":["../../src/scroll-restoration.tsx"],"sourcesContent":["import {\n defaultGetScrollRestorationKey,\n restoreScroll,\n storageKey,\n} from '@tanstack/router-core'\nimport { useRouter } from './useRouter'\nimport { ScriptOnce } from './ScriptOnce'\n\nexport function ScrollRestoration() {\n const router = useRouter()\n const getKey =\n router.options.getScrollRestorationKey || defaultGetScrollRestorationKey\n const userKey = getKey(router.latestLocation)\n const resolvedKey =\n userKey !== defaultGetScrollRestorationKey(router.latestLocation)\n ? userKey\n : undefined\n\n if (!router.isScrollRestoring || !router.isServer) {\n return null\n }\n\n const restoreScrollOptions: Parameters<typeof restoreScroll>[0] = {\n storageKey,\n shouldScrollRestoration: true,\n }\n if (resolvedKey) {\n restoreScrollOptions.key = resolvedKey\n }\n\n return (\n <ScriptOnce\n children={`(${restoreScroll.toString()})(${JSON.stringify(restoreScrollOptions)})`}\n />\n )\n}\n"],"names":[],"mappings":";;;;AAQO,SAAS,oBAAoB;AAClC,QAAM,SAAS,UAAU;AACnB,QAAA,SACJ,OAAO,QAAQ,2BAA2B;AACtC,QAAA,UAAU,OAAO,OAAO,cAAc;AAC5C,QAAM,cACJ,YAAY,+BAA+B,OAAO,cAAc,IAC5D,UACA;AAEN,MAAI,CAAC,OAAO,qBAAqB,CAAC,OAAO,UAAU;AAC1C,WAAA;AAAA,EAAA;AAGT,QAAM,uBAA4D;AAAA,IAChE;AAAA,IACA,yBAAyB;AAAA,EAC3B;AACA,MAAI,aAAa;AACf,yBAAqB,MAAM;AAAA,EAAA;AAI3B,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,UAAU,IAAI,cAAc,SAAA,CAAU,KAAK,KAAK,UAAU,oBAAoB,CAAC;AAAA,IAAA;AAAA,EACjF;AAEJ;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-router",
|
|
3
|
-
"version": "1.130.
|
|
3
|
+
"version": "1.130.1",
|
|
4
4
|
"description": "Modern and scalable routing for React applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -79,8 +79,8 @@
|
|
|
79
79
|
"isbot": "^5.1.22",
|
|
80
80
|
"tiny-invariant": "^1.3.3",
|
|
81
81
|
"tiny-warning": "^1.0.3",
|
|
82
|
-
"@tanstack/
|
|
83
|
-
"@tanstack/
|
|
82
|
+
"@tanstack/history": "1.129.7",
|
|
83
|
+
"@tanstack/router-core": "1.130.1"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@testing-library/jest-dom": "^6.6.3",
|
|
@@ -14,15 +14,23 @@ export function ScrollRestoration() {
|
|
|
14
14
|
const resolvedKey =
|
|
15
15
|
userKey !== defaultGetScrollRestorationKey(router.latestLocation)
|
|
16
16
|
? userKey
|
|
17
|
-
:
|
|
17
|
+
: undefined
|
|
18
18
|
|
|
19
19
|
if (!router.isScrollRestoring || !router.isServer) {
|
|
20
20
|
return null
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
const restoreScrollOptions: Parameters<typeof restoreScroll>[0] = {
|
|
24
|
+
storageKey,
|
|
25
|
+
shouldScrollRestoration: true,
|
|
26
|
+
}
|
|
27
|
+
if (resolvedKey) {
|
|
28
|
+
restoreScrollOptions.key = resolvedKey
|
|
29
|
+
}
|
|
30
|
+
|
|
23
31
|
return (
|
|
24
32
|
<ScriptOnce
|
|
25
|
-
children={`(${restoreScroll.toString()})(${JSON.stringify(
|
|
33
|
+
children={`(${restoreScroll.toString()})(${JSON.stringify(restoreScrollOptions)})`}
|
|
26
34
|
/>
|
|
27
35
|
)
|
|
28
36
|
}
|