@tanstack/router-plugin 1.167.13 → 1.167.14
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.
|
@@ -29,9 +29,9 @@ function handleRouteUpdate(routeId, newRoute) {
|
|
|
29
29
|
router.resolvePathCache.clear();
|
|
30
30
|
walkReplaceSegmentTree(oldRoute, router.processedTree.segmentTree);
|
|
31
31
|
const filter = (m) => m.routeId === oldRoute.id;
|
|
32
|
-
const activeMatch = router.stores.
|
|
33
|
-
const pendingMatch = router.stores.
|
|
34
|
-
const cachedMatches = router.stores.
|
|
32
|
+
const activeMatch = router.stores.matches.get().find(filter);
|
|
33
|
+
const pendingMatch = router.stores.pendingMatches.get().find(filter);
|
|
34
|
+
const cachedMatches = router.stores.cachedMatches.get().filter(filter);
|
|
35
35
|
if (activeMatch || pendingMatch || cachedMatches.length > 0) {
|
|
36
36
|
if (removedKeys.has("loader") || removedKeys.has("beforeLoad")) {
|
|
37
37
|
const matchIds = [
|
|
@@ -41,7 +41,7 @@ function handleRouteUpdate(routeId, newRoute) {
|
|
|
41
41
|
].filter(Boolean);
|
|
42
42
|
router.batch(() => {
|
|
43
43
|
for (const matchId of matchIds) {
|
|
44
|
-
const store = router.stores.
|
|
44
|
+
const store = router.stores.pendingMatchStores.get(matchId) || router.stores.matchStores.get(matchId) || router.stores.cachedMatchStores.get(matchId);
|
|
45
45
|
if (store) store.set((prev) => {
|
|
46
46
|
const next = { ...prev };
|
|
47
47
|
if (removedKeys.has("loader")) next.loaderData = void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-hmr-statement.cjs","names":[],"sources":["../../../src/core/route-hmr-statement.ts"],"sourcesContent":["import * as template from '@babel/template'\nimport { createHmrHotExpressionAst } from './hmr-hot-expression'\nimport type {\n AnyRoute,\n AnyRouteMatch,\n AnyRouter,\n RouterWritableStore,\n} from '@tanstack/router-core'\n\ntype AnyRouteWithPrivateProps = AnyRoute & {\n options: Record<string, unknown>\n _componentsPromise?: Promise<void>\n _lazyPromise?: Promise<void>\n update: (options: Record<string, unknown>) => unknown\n _path: string\n _id: string\n _fullPath: string\n _to: string\n}\n\ntype AnyRouterWithPrivateMaps = AnyRouter & {\n routesById: Record<string, AnyRoute>\n routesByPath: Record<string, AnyRoute>\n stores: AnyRouter['stores'] & {\n
|
|
1
|
+
{"version":3,"file":"route-hmr-statement.cjs","names":[],"sources":["../../../src/core/route-hmr-statement.ts"],"sourcesContent":["import * as template from '@babel/template'\nimport { createHmrHotExpressionAst } from './hmr-hot-expression'\nimport type {\n AnyRoute,\n AnyRouteMatch,\n AnyRouter,\n RouterWritableStore,\n} from '@tanstack/router-core'\n\ntype AnyRouteWithPrivateProps = AnyRoute & {\n options: Record<string, unknown>\n _componentsPromise?: Promise<void>\n _lazyPromise?: Promise<void>\n update: (options: Record<string, unknown>) => unknown\n _path: string\n _id: string\n _fullPath: string\n _to: string\n}\n\ntype AnyRouterWithPrivateMaps = AnyRouter & {\n routesById: Record<string, AnyRoute>\n routesByPath: Record<string, AnyRoute>\n stores: AnyRouter['stores'] & {\n cachedMatchStores: Map<\n string,\n Pick<RouterWritableStore<AnyRouteMatch>, 'set'>\n >\n pendingMatchStores: Map<\n string,\n Pick<RouterWritableStore<AnyRouteMatch>, 'set'>\n >\n matchStores: Map<string, Pick<RouterWritableStore<AnyRouteMatch>, 'set'>>\n }\n}\n\ntype AnyRouteMatchWithPrivateProps = AnyRouteMatch & {\n __beforeLoadContext?: unknown\n}\n\nfunction handleRouteUpdate(\n routeId: string,\n newRoute: AnyRouteWithPrivateProps,\n) {\n const router = window.__TSR_ROUTER__ as AnyRouterWithPrivateMaps\n const oldRoute = router.routesById[routeId] as\n | AnyRouteWithPrivateProps\n | undefined\n\n if (!oldRoute) {\n return\n }\n\n // Keys whose identity must remain stable to prevent React from\n // unmounting/remounting the component tree. React Fast Refresh already\n // handles hot-updating the function bodies of these components — our job\n // is only to update non-component route options (loader, head, etc.).\n // For code-split (splittable) routes, the lazyRouteComponent wrapper is\n // already cached in the bundler hot data so its identity is stable.\n // For unsplittable routes (e.g. root routes), the component is a plain\n // function reference that gets recreated on every module re-execution,\n // so we must explicitly preserve the old reference.\n const removedKeys = new Set<string>()\n Object.keys(oldRoute.options).forEach((key) => {\n if (!(key in newRoute.options)) {\n removedKeys.add(key)\n delete oldRoute.options[key]\n }\n })\n\n // Preserve component identity so React doesn't remount.\n // React Fast Refresh patches the function bodies in-place.\n const componentKeys = '__TSR_COMPONENT_TYPES__' as unknown as Array<string>\n componentKeys.forEach((key) => {\n if (key in oldRoute.options && key in newRoute.options) {\n newRoute.options[key] = oldRoute.options[key]\n }\n })\n\n oldRoute.options = newRoute.options\n oldRoute.update(newRoute.options)\n oldRoute._componentsPromise = undefined\n oldRoute._lazyPromise = undefined\n\n router.routesById[oldRoute.id] = oldRoute\n router.routesByPath[oldRoute.fullPath] = oldRoute\n\n router.processedTree.matchCache.clear()\n router.processedTree.flatCache?.clear()\n router.processedTree.singleCache.clear()\n router.resolvePathCache.clear()\n walkReplaceSegmentTree(oldRoute, router.processedTree.segmentTree)\n\n const filter = (m: AnyRouteMatch) => m.routeId === oldRoute.id\n const activeMatch = router.stores.matches.get().find(filter)\n const pendingMatch = router.stores.pendingMatches.get().find(filter)\n const cachedMatches = router.stores.cachedMatches.get().filter(filter)\n\n if (activeMatch || pendingMatch || cachedMatches.length > 0) {\n // Clear stale match data for removed route options BEFORE invalidating.\n // Without this, router.invalidate() -> matchRoutes() reuses the existing\n // match from the store (via ...existingMatch spread) and the stale\n // loaderData / __beforeLoadContext survives the reload cycle.\n //\n // We must update the store directly (not via router.updateMatch) because\n // updateMatch wraps in startTransition which may defer the state update,\n // and we need the clear to be visible before invalidate reads the store.\n if (removedKeys.has('loader') || removedKeys.has('beforeLoad')) {\n const matchIds = [\n activeMatch?.id,\n pendingMatch?.id,\n ...cachedMatches.map((match) => match.id),\n ].filter(Boolean) as Array<string>\n router.batch(() => {\n for (const matchId of matchIds) {\n const store =\n router.stores.pendingMatchStores.get(matchId) ||\n router.stores.matchStores.get(matchId) ||\n router.stores.cachedMatchStores.get(matchId)\n if (store) {\n store.set((prev) => {\n const next: AnyRouteMatchWithPrivateProps = { ...prev }\n\n if (removedKeys.has('loader')) {\n next.loaderData = undefined\n }\n if (removedKeys.has('beforeLoad')) {\n next.__beforeLoadContext = undefined\n }\n\n return next\n })\n }\n }\n })\n }\n\n router.invalidate({ filter, sync: true })\n }\n\n function walkReplaceSegmentTree(\n route: AnyRouteWithPrivateProps,\n node: AnyRouter['processedTree']['segmentTree'],\n ) {\n if (node.route?.id === route.id) node.route = route\n if (node.index) walkReplaceSegmentTree(route, node.index)\n node.static?.forEach((child) => walkReplaceSegmentTree(route, child))\n node.staticInsensitive?.forEach((child) =>\n walkReplaceSegmentTree(route, child),\n )\n node.dynamic?.forEach((child) => walkReplaceSegmentTree(route, child))\n node.optional?.forEach((child) => walkReplaceSegmentTree(route, child))\n node.wildcard?.forEach((child) => walkReplaceSegmentTree(route, child))\n }\n}\n\nconst handleRouteUpdateStr = handleRouteUpdate.toString()\n\nexport function createRouteHmrStatement(\n stableRouteOptionKeys: Array<string>,\n opts?: { hotExpression?: string },\n) {\n return template.statement(\n `\nif (%%hotExpression%%) {\n const hot = %%hotExpression%%\n const hotData = hot.data ??= {}\n hot.accept((newModule) => {\n if (Route && newModule && newModule.Route) {\n const routeId = hotData['tsr-route-id'] ?? Route.id\n if (routeId) {\n hotData['tsr-route-id'] = routeId\n }\n (${handleRouteUpdateStr.replace(\n /['\"]__TSR_COMPONENT_TYPES__['\"]/,\n JSON.stringify(stableRouteOptionKeys),\n )})(routeId, newModule.Route)\n }\n })\n}\n`,\n {\n syntacticPlaceholders: true,\n },\n )({\n hotExpression: createHmrHotExpressionAst(opts?.hotExpression),\n })\n}\n"],"mappings":";;;;;AAwCA,SAAS,kBACP,SACA,UACA;CACA,MAAM,SAAS,OAAO;CACtB,MAAM,WAAW,OAAO,WAAW;AAInC,KAAI,CAAC,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AkB,IAAI,QAAQ;AAC9C,SAAI,MACF,OAAM,KAAK,SAAS;MAClB,MAAM,OAAsC,EAAE,GAAG,MAAM;AAEvD,UAAI,YAAY,IAAI,SAAS,CAC3B,MAAK,aAAa,KAAA;AAEpB,UAAI,YAAY,IAAI,aAAa,CAC/B,MAAK,sBAAsB,KAAA;AAG7B,aAAO;OACP;;KAGN;;AAGJ,SAAO,WAAW;GAAE;GAAQ,MAAM;GAAM,CAAC;;CAG3C,SAAS,uBACP,OACA,MACA;AACA,MAAI,KAAK,OAAO,OAAO,MAAM,GAAI,MAAK,QAAQ;AAC9C,MAAI,KAAK,MAAO,wBAAuB,OAAO,KAAK,MAAM;AACzD,OAAK,QAAQ,SAAS,UAAU,uBAAuB,OAAO,MAAM,CAAC;AACrE,OAAK,mBAAmB,SAAS,UAC/B,uBAAuB,OAAO,MAAM,CACrC;AACD,OAAK,SAAS,SAAS,UAAU,uBAAuB,OAAO,MAAM,CAAC;AACtE,OAAK,UAAU,SAAS,UAAU,uBAAuB,OAAO,MAAM,CAAC;AACvE,OAAK,UAAU,SAAS,UAAU,uBAAuB,OAAO,MAAM,CAAC;;;AAI3E,IAAM,uBAAuB,kBAAkB,UAAU;AAEzD,SAAgB,wBACd,uBACA,MACA;AACA,QAAO,gBAAS,UACd;;;;;;;;;;SAUK,qBAAqB,QACtB,mCACA,KAAK,UAAU,sBAAsB,CACtC,CAAC;;;;GAKJ,EACE,uBAAuB,MACxB,CACF,CAAC,EACA,eAAe,2BAAA,0BAA0B,MAAM,cAAc,EAC9D,CAAC"}
|
|
@@ -27,9 +27,9 @@ function handleRouteUpdate(routeId, newRoute) {
|
|
|
27
27
|
router.resolvePathCache.clear();
|
|
28
28
|
walkReplaceSegmentTree(oldRoute, router.processedTree.segmentTree);
|
|
29
29
|
const filter = (m) => m.routeId === oldRoute.id;
|
|
30
|
-
const activeMatch = router.stores.
|
|
31
|
-
const pendingMatch = router.stores.
|
|
32
|
-
const cachedMatches = router.stores.
|
|
30
|
+
const activeMatch = router.stores.matches.get().find(filter);
|
|
31
|
+
const pendingMatch = router.stores.pendingMatches.get().find(filter);
|
|
32
|
+
const cachedMatches = router.stores.cachedMatches.get().filter(filter);
|
|
33
33
|
if (activeMatch || pendingMatch || cachedMatches.length > 0) {
|
|
34
34
|
if (removedKeys.has("loader") || removedKeys.has("beforeLoad")) {
|
|
35
35
|
const matchIds = [
|
|
@@ -39,7 +39,7 @@ function handleRouteUpdate(routeId, newRoute) {
|
|
|
39
39
|
].filter(Boolean);
|
|
40
40
|
router.batch(() => {
|
|
41
41
|
for (const matchId of matchIds) {
|
|
42
|
-
const store = router.stores.
|
|
42
|
+
const store = router.stores.pendingMatchStores.get(matchId) || router.stores.matchStores.get(matchId) || router.stores.cachedMatchStores.get(matchId);
|
|
43
43
|
if (store) store.set((prev) => {
|
|
44
44
|
const next = { ...prev };
|
|
45
45
|
if (removedKeys.has("loader")) next.loaderData = void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-hmr-statement.js","names":[],"sources":["../../../src/core/route-hmr-statement.ts"],"sourcesContent":["import * as template from '@babel/template'\nimport { createHmrHotExpressionAst } from './hmr-hot-expression'\nimport type {\n AnyRoute,\n AnyRouteMatch,\n AnyRouter,\n RouterWritableStore,\n} from '@tanstack/router-core'\n\ntype AnyRouteWithPrivateProps = AnyRoute & {\n options: Record<string, unknown>\n _componentsPromise?: Promise<void>\n _lazyPromise?: Promise<void>\n update: (options: Record<string, unknown>) => unknown\n _path: string\n _id: string\n _fullPath: string\n _to: string\n}\n\ntype AnyRouterWithPrivateMaps = AnyRouter & {\n routesById: Record<string, AnyRoute>\n routesByPath: Record<string, AnyRoute>\n stores: AnyRouter['stores'] & {\n
|
|
1
|
+
{"version":3,"file":"route-hmr-statement.js","names":[],"sources":["../../../src/core/route-hmr-statement.ts"],"sourcesContent":["import * as template from '@babel/template'\nimport { createHmrHotExpressionAst } from './hmr-hot-expression'\nimport type {\n AnyRoute,\n AnyRouteMatch,\n AnyRouter,\n RouterWritableStore,\n} from '@tanstack/router-core'\n\ntype AnyRouteWithPrivateProps = AnyRoute & {\n options: Record<string, unknown>\n _componentsPromise?: Promise<void>\n _lazyPromise?: Promise<void>\n update: (options: Record<string, unknown>) => unknown\n _path: string\n _id: string\n _fullPath: string\n _to: string\n}\n\ntype AnyRouterWithPrivateMaps = AnyRouter & {\n routesById: Record<string, AnyRoute>\n routesByPath: Record<string, AnyRoute>\n stores: AnyRouter['stores'] & {\n cachedMatchStores: Map<\n string,\n Pick<RouterWritableStore<AnyRouteMatch>, 'set'>\n >\n pendingMatchStores: Map<\n string,\n Pick<RouterWritableStore<AnyRouteMatch>, 'set'>\n >\n matchStores: Map<string, Pick<RouterWritableStore<AnyRouteMatch>, 'set'>>\n }\n}\n\ntype AnyRouteMatchWithPrivateProps = AnyRouteMatch & {\n __beforeLoadContext?: unknown\n}\n\nfunction handleRouteUpdate(\n routeId: string,\n newRoute: AnyRouteWithPrivateProps,\n) {\n const router = window.__TSR_ROUTER__ as AnyRouterWithPrivateMaps\n const oldRoute = router.routesById[routeId] as\n | AnyRouteWithPrivateProps\n | undefined\n\n if (!oldRoute) {\n return\n }\n\n // Keys whose identity must remain stable to prevent React from\n // unmounting/remounting the component tree. React Fast Refresh already\n // handles hot-updating the function bodies of these components — our job\n // is only to update non-component route options (loader, head, etc.).\n // For code-split (splittable) routes, the lazyRouteComponent wrapper is\n // already cached in the bundler hot data so its identity is stable.\n // For unsplittable routes (e.g. root routes), the component is a plain\n // function reference that gets recreated on every module re-execution,\n // so we must explicitly preserve the old reference.\n const removedKeys = new Set<string>()\n Object.keys(oldRoute.options).forEach((key) => {\n if (!(key in newRoute.options)) {\n removedKeys.add(key)\n delete oldRoute.options[key]\n }\n })\n\n // Preserve component identity so React doesn't remount.\n // React Fast Refresh patches the function bodies in-place.\n const componentKeys = '__TSR_COMPONENT_TYPES__' as unknown as Array<string>\n componentKeys.forEach((key) => {\n if (key in oldRoute.options && key in newRoute.options) {\n newRoute.options[key] = oldRoute.options[key]\n }\n })\n\n oldRoute.options = newRoute.options\n oldRoute.update(newRoute.options)\n oldRoute._componentsPromise = undefined\n oldRoute._lazyPromise = undefined\n\n router.routesById[oldRoute.id] = oldRoute\n router.routesByPath[oldRoute.fullPath] = oldRoute\n\n router.processedTree.matchCache.clear()\n router.processedTree.flatCache?.clear()\n router.processedTree.singleCache.clear()\n router.resolvePathCache.clear()\n walkReplaceSegmentTree(oldRoute, router.processedTree.segmentTree)\n\n const filter = (m: AnyRouteMatch) => m.routeId === oldRoute.id\n const activeMatch = router.stores.matches.get().find(filter)\n const pendingMatch = router.stores.pendingMatches.get().find(filter)\n const cachedMatches = router.stores.cachedMatches.get().filter(filter)\n\n if (activeMatch || pendingMatch || cachedMatches.length > 0) {\n // Clear stale match data for removed route options BEFORE invalidating.\n // Without this, router.invalidate() -> matchRoutes() reuses the existing\n // match from the store (via ...existingMatch spread) and the stale\n // loaderData / __beforeLoadContext survives the reload cycle.\n //\n // We must update the store directly (not via router.updateMatch) because\n // updateMatch wraps in startTransition which may defer the state update,\n // and we need the clear to be visible before invalidate reads the store.\n if (removedKeys.has('loader') || removedKeys.has('beforeLoad')) {\n const matchIds = [\n activeMatch?.id,\n pendingMatch?.id,\n ...cachedMatches.map((match) => match.id),\n ].filter(Boolean) as Array<string>\n router.batch(() => {\n for (const matchId of matchIds) {\n const store =\n router.stores.pendingMatchStores.get(matchId) ||\n router.stores.matchStores.get(matchId) ||\n router.stores.cachedMatchStores.get(matchId)\n if (store) {\n store.set((prev) => {\n const next: AnyRouteMatchWithPrivateProps = { ...prev }\n\n if (removedKeys.has('loader')) {\n next.loaderData = undefined\n }\n if (removedKeys.has('beforeLoad')) {\n next.__beforeLoadContext = undefined\n }\n\n return next\n })\n }\n }\n })\n }\n\n router.invalidate({ filter, sync: true })\n }\n\n function walkReplaceSegmentTree(\n route: AnyRouteWithPrivateProps,\n node: AnyRouter['processedTree']['segmentTree'],\n ) {\n if (node.route?.id === route.id) node.route = route\n if (node.index) walkReplaceSegmentTree(route, node.index)\n node.static?.forEach((child) => walkReplaceSegmentTree(route, child))\n node.staticInsensitive?.forEach((child) =>\n walkReplaceSegmentTree(route, child),\n )\n node.dynamic?.forEach((child) => walkReplaceSegmentTree(route, child))\n node.optional?.forEach((child) => walkReplaceSegmentTree(route, child))\n node.wildcard?.forEach((child) => walkReplaceSegmentTree(route, child))\n }\n}\n\nconst handleRouteUpdateStr = handleRouteUpdate.toString()\n\nexport function createRouteHmrStatement(\n stableRouteOptionKeys: Array<string>,\n opts?: { hotExpression?: string },\n) {\n return template.statement(\n `\nif (%%hotExpression%%) {\n const hot = %%hotExpression%%\n const hotData = hot.data ??= {}\n hot.accept((newModule) => {\n if (Route && newModule && newModule.Route) {\n const routeId = hotData['tsr-route-id'] ?? Route.id\n if (routeId) {\n hotData['tsr-route-id'] = routeId\n }\n (${handleRouteUpdateStr.replace(\n /['\"]__TSR_COMPONENT_TYPES__['\"]/,\n JSON.stringify(stableRouteOptionKeys),\n )})(routeId, newModule.Route)\n }\n })\n}\n`,\n {\n syntacticPlaceholders: true,\n },\n )({\n hotExpression: createHmrHotExpressionAst(opts?.hotExpression),\n })\n}\n"],"mappings":";;;AAwCA,SAAS,kBACP,SACA,UACA;CACA,MAAM,SAAS,OAAO;CACtB,MAAM,WAAW,OAAO,WAAW;AAInC,KAAI,CAAC,SACH;CAYF,MAAM,8BAAc,IAAI,KAAa;AACrC,QAAO,KAAK,SAAS,QAAQ,CAAC,SAAS,QAAQ;AAC7C,MAAI,EAAE,OAAO,SAAS,UAAU;AAC9B,eAAY,IAAI,IAAI;AACpB,UAAO,SAAS,QAAQ;;GAE1B;AAIoB,2BACR,SAAS,QAAQ;AAC7B,MAAI,OAAO,SAAS,WAAW,OAAO,SAAS,QAC7C,UAAS,QAAQ,OAAO,SAAS,QAAQ;GAE3C;AAEF,UAAS,UAAU,SAAS;AAC5B,UAAS,OAAO,SAAS,QAAQ;AACjC,UAAS,qBAAqB,KAAA;AAC9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MAAO,wBAAuB,OAAO,KAAK,MAAM;AACzD,OAAK,QAAQ,SAAS,UAAU,uBAAuB,OAAO,MAAM,CAAC;AACrE,OAAK,mBAAmB,SAAS,UAC/B,uBAAuB,OAAO,MAAM,CACrC;AACD,OAAK,SAAS,SAAS,UAAU,uBAAuB,OAAO,MAAM,CAAC;AACtE,OAAK,UAAU,SAAS,UAAU,uBAAuB,OAAO,MAAM,CAAC;AACvE,OAAK,UAAU,SAAS,UAAU,uBAAuB,OAAO,MAAM,CAAC;;;AAI3E,IAAM,uBAAuB,kBAAkB,UAAU;AAEzD,SAAgB,wBACd,uBACA,MACA;AACA,QAAO,SAAS,UACd;;;;;;;;;;SAUK,qBAAqB,QACtB,mCACA,KAAK,UAAU,sBAAsB,CACtC,CAAC;;;;GAKJ,EACE,uBAAuB,MACxB,CACF,CAAC,EACA,eAAe,0BAA0B,MAAM,cAAc,EAC9D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/router-plugin",
|
|
3
|
-
"version": "1.167.
|
|
3
|
+
"version": "1.167.14",
|
|
4
4
|
"description": "Modern and scalable routing for React applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -99,8 +99,8 @@
|
|
|
99
99
|
"chokidar": "^3.6.0",
|
|
100
100
|
"unplugin": "^2.1.2",
|
|
101
101
|
"zod": "^3.24.2",
|
|
102
|
-
"@tanstack/router-core": "1.168.
|
|
103
|
-
"@tanstack/router-generator": "1.166.
|
|
102
|
+
"@tanstack/router-core": "1.168.11",
|
|
103
|
+
"@tanstack/router-generator": "1.166.26",
|
|
104
104
|
"@tanstack/router-utils": "1.161.6",
|
|
105
105
|
"@tanstack/virtual-file-routes": "1.161.7"
|
|
106
106
|
},
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"vite": ">=5.0.0 || >=6.0.0 || >=7.0.0",
|
|
117
117
|
"vite-plugin-solid": "^2.11.10",
|
|
118
118
|
"webpack": ">=5.92.0",
|
|
119
|
-
"@tanstack/react-router": "^1.168.
|
|
119
|
+
"@tanstack/react-router": "^1.168.15"
|
|
120
120
|
},
|
|
121
121
|
"peerDependenciesMeta": {
|
|
122
122
|
"@rsbuild/core": {
|
|
@@ -22,18 +22,15 @@ type AnyRouterWithPrivateMaps = AnyRouter & {
|
|
|
22
22
|
routesById: Record<string, AnyRoute>
|
|
23
23
|
routesByPath: Record<string, AnyRoute>
|
|
24
24
|
stores: AnyRouter['stores'] & {
|
|
25
|
-
|
|
25
|
+
cachedMatchStores: Map<
|
|
26
26
|
string,
|
|
27
27
|
Pick<RouterWritableStore<AnyRouteMatch>, 'set'>
|
|
28
28
|
>
|
|
29
|
-
|
|
30
|
-
string,
|
|
31
|
-
Pick<RouterWritableStore<AnyRouteMatch>, 'set'>
|
|
32
|
-
>
|
|
33
|
-
activeMatchStoresById: Map<
|
|
29
|
+
pendingMatchStores: Map<
|
|
34
30
|
string,
|
|
35
31
|
Pick<RouterWritableStore<AnyRouteMatch>, 'set'>
|
|
36
32
|
>
|
|
33
|
+
matchStores: Map<string, Pick<RouterWritableStore<AnyRouteMatch>, 'set'>>
|
|
37
34
|
}
|
|
38
35
|
}
|
|
39
36
|
|
|
@@ -95,9 +92,9 @@ function handleRouteUpdate(
|
|
|
95
92
|
walkReplaceSegmentTree(oldRoute, router.processedTree.segmentTree)
|
|
96
93
|
|
|
97
94
|
const filter = (m: AnyRouteMatch) => m.routeId === oldRoute.id
|
|
98
|
-
const activeMatch = router.stores.
|
|
99
|
-
const pendingMatch = router.stores.
|
|
100
|
-
const cachedMatches = router.stores.
|
|
95
|
+
const activeMatch = router.stores.matches.get().find(filter)
|
|
96
|
+
const pendingMatch = router.stores.pendingMatches.get().find(filter)
|
|
97
|
+
const cachedMatches = router.stores.cachedMatches.get().filter(filter)
|
|
101
98
|
|
|
102
99
|
if (activeMatch || pendingMatch || cachedMatches.length > 0) {
|
|
103
100
|
// Clear stale match data for removed route options BEFORE invalidating.
|
|
@@ -117,9 +114,9 @@ function handleRouteUpdate(
|
|
|
117
114
|
router.batch(() => {
|
|
118
115
|
for (const matchId of matchIds) {
|
|
119
116
|
const store =
|
|
120
|
-
router.stores.
|
|
121
|
-
router.stores.
|
|
122
|
-
router.stores.
|
|
117
|
+
router.stores.pendingMatchStores.get(matchId) ||
|
|
118
|
+
router.stores.matchStores.get(matchId) ||
|
|
119
|
+
router.stores.cachedMatchStores.get(matchId)
|
|
123
120
|
if (store) {
|
|
124
121
|
store.set((prev) => {
|
|
125
122
|
const next: AnyRouteMatchWithPrivateProps = { ...prev }
|