@tanstack/solid-router 1.142.11 → 1.143.3
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/cjs/Transitioner.cjs +1 -1
- package/dist/cjs/Transitioner.cjs.map +1 -1
- package/dist/esm/Transitioner.js +1 -1
- package/dist/esm/Transitioner.js.map +1 -1
- package/dist/source/Transitioner.jsx +5 -2
- package/dist/source/Transitioner.jsx.map +1 -1
- package/package.json +2 -2
- package/src/Transitioner.tsx +5 -2
|
@@ -60,7 +60,7 @@ function Transitioner() {
|
|
|
60
60
|
state: true,
|
|
61
61
|
_includeValidateSearch: true
|
|
62
62
|
});
|
|
63
|
-
if (routerCore.trimPathRight(router.latestLocation.
|
|
63
|
+
if (routerCore.trimPathRight(router.latestLocation.publicHref) !== routerCore.trimPathRight(nextLocation.publicHref)) {
|
|
64
64
|
router.commitLocation({
|
|
65
65
|
...nextLocation,
|
|
66
66
|
replace: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transitioner.cjs","sources":["../../src/Transitioner.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport {\n getLocationChangeInfo,\n handleHashScroll,\n trimPathRight,\n} from '@tanstack/router-core'\nimport { useRouter } from './useRouter'\nimport { useRouterState } from './useRouterState'\nimport { usePrevious } from './utils'\n\nexport function Transitioner() {\n const router = useRouter()\n let mountLoadForRouter = { router, mounted: false }\n const isLoading = useRouterState({\n select: ({ isLoading }) => isLoading,\n })\n\n if (router.isServer) {\n return null\n }\n\n const [isSolidTransitioning, startSolidTransition] = Solid.useTransition()\n\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(isLoading)\n\n const isAnyPending = () =>\n isLoading() || isSolidTransitioning() || hasPendingMatches()\n const previousIsAnyPending = usePrevious(isAnyPending)\n\n const isPagePending = () => isLoading() || hasPendingMatches()\n const previousIsPagePending = usePrevious(isPagePending)\n\n router.startTransition = (fn: () => void | Promise<void>) => {\n Solid.startTransition(() => {\n startSolidTransition(fn)\n })\n }\n\n // Subscribe to location changes\n // and try to load the new location\n Solid.onMount(() => {\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 _includeValidateSearch: true,\n })\n\n if (\n trimPathRight(router.latestLocation.
|
|
1
|
+
{"version":3,"file":"Transitioner.cjs","sources":["../../src/Transitioner.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport {\n getLocationChangeInfo,\n handleHashScroll,\n trimPathRight,\n} from '@tanstack/router-core'\nimport { useRouter } from './useRouter'\nimport { useRouterState } from './useRouterState'\nimport { usePrevious } from './utils'\n\nexport function Transitioner() {\n const router = useRouter()\n let mountLoadForRouter = { router, mounted: false }\n const isLoading = useRouterState({\n select: ({ isLoading }) => isLoading,\n })\n\n if (router.isServer) {\n return null\n }\n\n const [isSolidTransitioning, startSolidTransition] = Solid.useTransition()\n\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(isLoading)\n\n const isAnyPending = () =>\n isLoading() || isSolidTransitioning() || hasPendingMatches()\n const previousIsAnyPending = usePrevious(isAnyPending)\n\n const isPagePending = () => isLoading() || hasPendingMatches()\n const previousIsPagePending = usePrevious(isPagePending)\n\n router.startTransition = (fn: () => void | Promise<void>) => {\n Solid.startTransition(() => {\n startSolidTransition(fn)\n })\n }\n\n // Subscribe to location changes\n // and try to load the new location\n Solid.onMount(() => {\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 _includeValidateSearch: true,\n })\n\n // Check if the current URL matches the canonical form.\n // Compare publicHref (browser-facing URL) for consistency with\n // the server-side redirect check in router.beforeLoad.\n if (\n trimPathRight(router.latestLocation.publicHref) !==\n trimPathRight(nextLocation.publicHref)\n ) {\n router.commitLocation({ ...nextLocation, replace: true })\n }\n\n Solid.onCleanup(() => {\n unsub()\n })\n })\n\n // Try to load the initial location\n Solid.createRenderEffect(() => {\n Solid.untrack(() => {\n if (\n // if we are hydrating from SSR, loading is triggered in ssr-client\n (typeof window !== 'undefined' && router.ssr) ||\n (mountLoadForRouter.router === router && mountLoadForRouter.mounted)\n ) {\n return\n }\n mountLoadForRouter = { router, mounted: true }\n const tryLoad = async () => {\n try {\n await router.load()\n } catch (err) {\n console.error(err)\n }\n }\n tryLoad()\n })\n })\n\n Solid.createRenderEffect(\n Solid.on(\n [previousIsLoading, isLoading],\n ([previousIsLoading, isLoading]) => {\n if (previousIsLoading.previous && !isLoading) {\n router.emit({\n type: 'onLoad',\n ...getLocationChangeInfo(router.state),\n })\n }\n },\n ),\n )\n\n Solid.createComputed(\n Solid.on(\n [isPagePending, previousIsPagePending],\n ([isPagePending, previousIsPagePending]) => {\n // emit onBeforeRouteMount\n if (previousIsPagePending.previous && !isPagePending) {\n router.emit({\n type: 'onBeforeRouteMount',\n ...getLocationChangeInfo(router.state),\n })\n }\n },\n ),\n )\n\n Solid.createRenderEffect(\n Solid.on(\n [isAnyPending, previousIsAnyPending],\n ([isAnyPending, previousIsAnyPending]) => {\n if (previousIsAnyPending.previous && !isAnyPending) {\n const changeInfo = getLocationChangeInfo(router.state)\n router.emit({\n type: 'onResolved',\n ...changeInfo,\n })\n\n router.__store.setState((s) => ({\n ...s,\n status: 'idle',\n resolvedLocation: s.location,\n }))\n\n if (changeInfo.hrefChanged) {\n handleHashScroll(router)\n }\n }\n },\n ),\n )\n\n return null\n}\n"],"names":["Transitioner","router","useRouter","mountLoadForRouter","mounted","isLoading","useRouterState","select","isServer","isSolidTransitioning","startSolidTransition","Solid","useTransition","hasPendingMatches","s","matches","some","d","status","previousIsLoading","usePrevious","isAnyPending","previousIsAnyPending","isPagePending","previousIsPagePending","startTransition","fn","onMount","unsub","history","subscribe","load","nextLocation","buildLocation","to","latestLocation","pathname","search","params","hash","state","_includeValidateSearch","trimPathRight","publicHref","commitLocation","replace","onCleanup","createRenderEffect","untrack","window","ssr","tryLoad","err","console","error","on","previous","emit","type","getLocationChangeInfo","createComputed","changeInfo","__store","setState","resolvedLocation","location","hrefChanged","handleHashScroll"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAUO,SAASA,eAAe;AAC7B,QAAMC,SAASC,UAAAA,UAAAA;AACf,MAAIC,qBAAqB;AAAA,IAAEF;AAAAA,IAAQG,SAAS;AAAA,EAAA;AAC5C,QAAMC,YAAYC,eAAAA,eAAe;AAAA,IAC/BC,QAAQA,CAAC;AAAA,MAAEF,WAAAA;AAAAA,IAAAA,MAAgBA;AAAAA,EAAAA,CAC5B;AAED,MAAIJ,OAAOO,UAAU;AACnB,WAAO;AAAA,EACT;AAEA,QAAM,CAACC,sBAAsBC,oBAAoB,IAAIC,iBAAMC,cAAAA;AAG3D,QAAMC,oBAAoBP,eAAAA,eAAe;AAAA,IACvCC,QAASO,OAAMA,EAAEC,QAAQC,KAAMC,CAAAA,MAAMA,EAAEC,WAAW,SAAS;AAAA,EAAA,CAC5D;AAED,QAAMC,oBAAoBC,MAAAA,YAAYf,SAAS;AAE/C,QAAMgB,eAAeA,MACnBhB,UAAAA,KAAeI,qBAAAA,KAA0BI,kBAAAA;AAC3C,QAAMS,uBAAuBF,MAAAA,YAAYC,YAAY;AAErD,QAAME,gBAAgBA,MAAMlB,UAAAA,KAAeQ,kBAAAA;AAC3C,QAAMW,wBAAwBJ,MAAAA,YAAYG,aAAa;AAEvDtB,SAAOwB,kBAAkB,CAACC,OAAmC;AAC3Df,qBAAMc,gBAAgB,MAAM;AAC1Bf,2BAAqBgB,EAAE;AAAA,IACzB,CAAC;AAAA,EACH;AAIAf,mBAAMgB,QAAQ,MAAM;AAClB,UAAMC,QAAQ3B,OAAO4B,QAAQC,UAAU7B,OAAO8B,IAAI;AAElD,UAAMC,eAA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ACrC,CAAC,CAACD,gBAAeC,sBAAqB,MAAM;AAE1C,QAAIA,uBAAsBgC,YAAY,CAACjC,gBAAe;AACpDtB,aAAOwD,KAAK;AAAA,QACVC,MAAM;AAAA,QACN,GAAGC,WAAAA,sBAAsB1D,OAAOuC,KAAK;AAAA,MAAA,CACtC;AAAA,IACH;AAAA,EACF,CACF,CACF;AAEA7B,mBAAMoC,mBACJpC,iBAAM4C,GACJ,CAAClC,cAAcC,oBAAoB,GACnC,CAAC,CAACD,eAAcC,qBAAoB,MAAM;AACxC,QAAIA,sBAAqBkC,YAAY,CAACnC,eAAc;AAClD,YAAMwC,aAAaF,WAAAA,sBAAsB1D,OAAOuC,KAAK;AACrDvC,aAAOwD,KAAK;AAAA,QACVC,MAAM;AAAA,QACN,GAAGG;AAAAA,MAAAA,CACJ;AAED5D,aAAO6D,QAAQC,SAAUjD,CAAAA,OAAO;AAAA,QAC9B,GAAGA;AAAAA,QACHI,QAAQ;AAAA,QACR8C,kBAAkBlD,EAAEmD;AAAAA,MAAAA,EACpB;AAEF,UAAIJ,WAAWK,aAAa;AAC1BC,mBAAAA,iBAAiBlE,MAAM;AAAA,MACzB;AAAA,IACF;AAAA,EACF,CACF,CACF;AAEA,SAAO;AACT;;"}
|
package/dist/esm/Transitioner.js
CHANGED
|
@@ -41,7 +41,7 @@ function Transitioner() {
|
|
|
41
41
|
state: true,
|
|
42
42
|
_includeValidateSearch: true
|
|
43
43
|
});
|
|
44
|
-
if (trimPathRight(router.latestLocation.
|
|
44
|
+
if (trimPathRight(router.latestLocation.publicHref) !== trimPathRight(nextLocation.publicHref)) {
|
|
45
45
|
router.commitLocation({
|
|
46
46
|
...nextLocation,
|
|
47
47
|
replace: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transitioner.js","sources":["../../src/Transitioner.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport {\n getLocationChangeInfo,\n handleHashScroll,\n trimPathRight,\n} from '@tanstack/router-core'\nimport { useRouter } from './useRouter'\nimport { useRouterState } from './useRouterState'\nimport { usePrevious } from './utils'\n\nexport function Transitioner() {\n const router = useRouter()\n let mountLoadForRouter = { router, mounted: false }\n const isLoading = useRouterState({\n select: ({ isLoading }) => isLoading,\n })\n\n if (router.isServer) {\n return null\n }\n\n const [isSolidTransitioning, startSolidTransition] = Solid.useTransition()\n\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(isLoading)\n\n const isAnyPending = () =>\n isLoading() || isSolidTransitioning() || hasPendingMatches()\n const previousIsAnyPending = usePrevious(isAnyPending)\n\n const isPagePending = () => isLoading() || hasPendingMatches()\n const previousIsPagePending = usePrevious(isPagePending)\n\n router.startTransition = (fn: () => void | Promise<void>) => {\n Solid.startTransition(() => {\n startSolidTransition(fn)\n })\n }\n\n // Subscribe to location changes\n // and try to load the new location\n Solid.onMount(() => {\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 _includeValidateSearch: true,\n })\n\n if (\n trimPathRight(router.latestLocation.
|
|
1
|
+
{"version":3,"file":"Transitioner.js","sources":["../../src/Transitioner.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport {\n getLocationChangeInfo,\n handleHashScroll,\n trimPathRight,\n} from '@tanstack/router-core'\nimport { useRouter } from './useRouter'\nimport { useRouterState } from './useRouterState'\nimport { usePrevious } from './utils'\n\nexport function Transitioner() {\n const router = useRouter()\n let mountLoadForRouter = { router, mounted: false }\n const isLoading = useRouterState({\n select: ({ isLoading }) => isLoading,\n })\n\n if (router.isServer) {\n return null\n }\n\n const [isSolidTransitioning, startSolidTransition] = Solid.useTransition()\n\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(isLoading)\n\n const isAnyPending = () =>\n isLoading() || isSolidTransitioning() || hasPendingMatches()\n const previousIsAnyPending = usePrevious(isAnyPending)\n\n const isPagePending = () => isLoading() || hasPendingMatches()\n const previousIsPagePending = usePrevious(isPagePending)\n\n router.startTransition = (fn: () => void | Promise<void>) => {\n Solid.startTransition(() => {\n startSolidTransition(fn)\n })\n }\n\n // Subscribe to location changes\n // and try to load the new location\n Solid.onMount(() => {\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 _includeValidateSearch: true,\n })\n\n // Check if the current URL matches the canonical form.\n // Compare publicHref (browser-facing URL) for consistency with\n // the server-side redirect check in router.beforeLoad.\n if (\n trimPathRight(router.latestLocation.publicHref) !==\n trimPathRight(nextLocation.publicHref)\n ) {\n router.commitLocation({ ...nextLocation, replace: true })\n }\n\n Solid.onCleanup(() => {\n unsub()\n })\n })\n\n // Try to load the initial location\n Solid.createRenderEffect(() => {\n Solid.untrack(() => {\n if (\n // if we are hydrating from SSR, loading is triggered in ssr-client\n (typeof window !== 'undefined' && router.ssr) ||\n (mountLoadForRouter.router === router && mountLoadForRouter.mounted)\n ) {\n return\n }\n mountLoadForRouter = { router, mounted: true }\n const tryLoad = async () => {\n try {\n await router.load()\n } catch (err) {\n console.error(err)\n }\n }\n tryLoad()\n })\n })\n\n Solid.createRenderEffect(\n Solid.on(\n [previousIsLoading, isLoading],\n ([previousIsLoading, isLoading]) => {\n if (previousIsLoading.previous && !isLoading) {\n router.emit({\n type: 'onLoad',\n ...getLocationChangeInfo(router.state),\n })\n }\n },\n ),\n )\n\n Solid.createComputed(\n Solid.on(\n [isPagePending, previousIsPagePending],\n ([isPagePending, previousIsPagePending]) => {\n // emit onBeforeRouteMount\n if (previousIsPagePending.previous && !isPagePending) {\n router.emit({\n type: 'onBeforeRouteMount',\n ...getLocationChangeInfo(router.state),\n })\n }\n },\n ),\n )\n\n Solid.createRenderEffect(\n Solid.on(\n [isAnyPending, previousIsAnyPending],\n ([isAnyPending, previousIsAnyPending]) => {\n if (previousIsAnyPending.previous && !isAnyPending) {\n const changeInfo = getLocationChangeInfo(router.state)\n router.emit({\n type: 'onResolved',\n ...changeInfo,\n })\n\n router.__store.setState((s) => ({\n ...s,\n status: 'idle',\n resolvedLocation: s.location,\n }))\n\n if (changeInfo.hrefChanged) {\n handleHashScroll(router)\n }\n }\n },\n ),\n )\n\n return null\n}\n"],"names":["Transitioner","router","useRouter","mountLoadForRouter","mounted","isLoading","useRouterState","select","isServer","isSolidTransitioning","startSolidTransition","Solid","useTransition","hasPendingMatches","s","matches","some","d","status","previousIsLoading","usePrevious","isAnyPending","previousIsAnyPending","isPagePending","previousIsPagePending","startTransition","fn","onMount","unsub","history","subscribe","load","nextLocation","buildLocation","to","latestLocation","pathname","search","params","hash","state","_includeValidateSearch","trimPathRight","publicHref","commitLocation","replace","onCleanup","createRenderEffect","untrack","window","ssr","tryLoad","err","console","error","on","previous","emit","type","getLocationChangeInfo","createComputed","changeInfo","__store","setState","resolvedLocation","location","hrefChanged","handleHashScroll"],"mappings":";;;;;AAUO,SAASA,eAAe;AAC7B,QAAMC,SAASC,UAAAA;AACf,MAAIC,qBAAqB;AAAA,IAAEF;AAAAA,IAAQG,SAAS;AAAA,EAAA;AAC5C,QAAMC,YAAYC,eAAe;AAAA,IAC/BC,QAAQA,CAAC;AAAA,MAAEF,WAAAA;AAAAA,IAAAA,MAAgBA;AAAAA,EAAAA,CAC5B;AAED,MAAIJ,OAAOO,UAAU;AACnB,WAAO;AAAA,EACT;AAEA,QAAM,CAACC,sBAAsBC,oBAAoB,IAAIC,MAAMC,cAAAA;AAG3D,QAAMC,oBAAoBP,eAAe;AAAA,IACvCC,QAASO,OAAMA,EAAEC,QAAQC,KAAMC,CAAAA,MAAMA,EAAEC,WAAW,SAAS;AAAA,EAAA,CAC5D;AAED,QAAMC,oBAAoBC,YAAYf,SAAS;AAE/C,QAAMgB,eAAeA,MACnBhB,UAAAA,KAAeI,qBAAA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A,EACH,CAAC;AAEDxC,QAAMoC,mBACJpC,MAAM4C,GACJ,CAACpC,mBAAmBd,SAAS,GAC7B,CAAC,CAACc,oBAAmBd,UAAS,MAAM;AAClC,QAAIc,mBAAkBqC,YAAY,CAACnD,YAAW;AAC5CJ,aAAOwD,KAAK;AAAA,QACVC,MAAM;AAAA,QACN,GAAGC,sBAAsB1D,OAAOuC,KAAK;AAAA,MAAA,CACtC;AAAA,IACH;AAAA,EACF,CACF,CACF;AAEA7B,QAAMiD,eACJjD,MAAM4C,GACJ,CAAChC,eAAeC,qBAAqB,GACrC,CAAC,CAACD,gBAAeC,sBAAqB,MAAM;AAE1C,QAAIA,uBAAsBgC,YAAY,CAACjC,gBAAe;AACpDtB,aAAOwD,KAAK;AAAA,QACVC,MAAM;AAAA,QACN,GAAGC,sBAAsB1D,OAAOuC,KAAK;AAAA,MAAA,CACtC;AAAA,IACH;AAAA,EACF,CACF,CACF;AAEA7B,QAAMoC,mBACJpC,MAAM4C,GACJ,CAAClC,cAAcC,oBAAoB,GACnC,CAAC,CAACD,eAAcC,qBAAoB,MAAM;AACxC,QAAIA,sBAAqBkC,YAAY,CAACnC,eAAc;AAClD,YAAMwC,aAAaF,sBAAsB1D,OAAOuC,KAAK;AACrDvC,aAAOwD,KAAK;AAAA,QACVC,MAAM;AAAA,QACN,GAAGG;AAAAA,MAAAA,CACJ;AAED5D,aAAO6D,QAAQC,SAAUjD,CAAAA,OAAO;AAAA,QAC9B,GAAGA;AAAAA,QACHI,QAAQ;AAAA,QACR8C,kBAAkBlD,EAAEmD;AAAAA,MAAAA,EACpB;AAEF,UAAIJ,WAAWK,aAAa;AAC1BC,yBAAiBlE,MAAM;AAAA,MACzB;AAAA,IACF;AAAA,EACF,CACF,CACF;AAEA,SAAO;AACT;"}
|
|
@@ -39,8 +39,11 @@ export function Transitioner() {
|
|
|
39
39
|
state: true,
|
|
40
40
|
_includeValidateSearch: true,
|
|
41
41
|
});
|
|
42
|
-
if
|
|
43
|
-
|
|
42
|
+
// Check if the current URL matches the canonical form.
|
|
43
|
+
// Compare publicHref (browser-facing URL) for consistency with
|
|
44
|
+
// the server-side redirect check in router.beforeLoad.
|
|
45
|
+
if (trimPathRight(router.latestLocation.publicHref) !==
|
|
46
|
+
trimPathRight(nextLocation.publicHref)) {
|
|
44
47
|
router.commitLocation({ ...nextLocation, replace: true });
|
|
45
48
|
}
|
|
46
49
|
Solid.onCleanup(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transitioner.jsx","sourceRoot":"","sources":["../../src/Transitioner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AACjC,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,GACd,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC,MAAM,UAAU,YAAY;IAC1B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,IAAI,kBAAkB,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;IACnD,MAAM,SAAS,GAAG,cAAc,CAAC;QAC/B,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,SAAS;KACrC,CAAC,CAAA;IAEF,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,CAAC,oBAAoB,EAAE,oBAAoB,CAAC,GAAG,KAAK,CAAC,aAAa,EAAE,CAAA;IAE1E,8BAA8B;IAC9B,MAAM,iBAAiB,GAAG,cAAc,CAAC;QACvC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC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oBAAoB,CAAC,QAAQ,IAAI,CAAC,YAAY,EAAE,CAAC;YACnD,MAAM,UAAU,GAAG,qBAAqB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YACtD,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,YAAY;gBAClB,GAAG,UAAU;aACd,CAAC,CAAA;YAEF,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC9B,GAAG,CAAC;gBACJ,MAAM,EAAE,MAAM;gBACd,gBAAgB,EAAE,CAAC,CAAC,QAAQ;aAC7B,CAAC,CAAC,CAAA;YAEH,IAAI,UAAU,CAAC,WAAW,EAAE,CAAC;gBAC3B,gBAAgB,CAAC,MAAM,CAAC,CAAA;YAC1B,CAAC;QACH,CAAC;IACH,CAAC,CACF,CACF,CAAA;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/solid-router",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.143.3",
|
|
4
4
|
"description": "Modern and scalable routing for Solid applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"tiny-invariant": "^1.3.3",
|
|
90
90
|
"tiny-warning": "^1.0.3",
|
|
91
91
|
"@tanstack/history": "1.141.0",
|
|
92
|
-
"@tanstack/router-core": "1.
|
|
92
|
+
"@tanstack/router-core": "1.143.3"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
95
|
"@solidjs/testing-library": "^0.8.10",
|
package/src/Transitioner.tsx
CHANGED
|
@@ -55,9 +55,12 @@ export function Transitioner() {
|
|
|
55
55
|
_includeValidateSearch: true,
|
|
56
56
|
})
|
|
57
57
|
|
|
58
|
+
// Check if the current URL matches the canonical form.
|
|
59
|
+
// Compare publicHref (browser-facing URL) for consistency with
|
|
60
|
+
// the server-side redirect check in router.beforeLoad.
|
|
58
61
|
if (
|
|
59
|
-
trimPathRight(router.latestLocation.
|
|
60
|
-
trimPathRight(nextLocation.
|
|
62
|
+
trimPathRight(router.latestLocation.publicHref) !==
|
|
63
|
+
trimPathRight(nextLocation.publicHref)
|
|
61
64
|
) {
|
|
62
65
|
router.commitLocation({ ...nextLocation, replace: true })
|
|
63
66
|
}
|