@tanstack/router-core 1.161.4 → 1.162.2
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/isServer/server.cjs +1 -1
- package/dist/cjs/isServer/server.cjs.map +1 -1
- package/dist/cjs/isServer/server.d.cts +1 -1
- package/dist/cjs/router.cjs +3 -11
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/esm/isServer/server.d.ts +1 -1
- package/dist/esm/isServer/server.js +1 -1
- package/dist/esm/isServer/server.js.map +1 -1
- package/dist/esm/router.js +3 -11
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/isServer/server.ts +1 -1
- package/src/router.ts +11 -23
package/package.json
CHANGED
package/src/isServer/server.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const isServer = true
|
|
1
|
+
export const isServer = process.env.NODE_ENV === 'test' ? undefined : true
|
package/src/router.ts
CHANGED
|
@@ -1852,32 +1852,23 @@ export class RouterCore<
|
|
|
1852
1852
|
functionalUpdate(dest.params as any, fromParams),
|
|
1853
1853
|
)
|
|
1854
1854
|
|
|
1855
|
-
// Interpolate the path first to get the actual resolved path, then match against that
|
|
1856
|
-
const interpolatedNextTo = interpolatePath({
|
|
1857
|
-
path: nextTo,
|
|
1858
|
-
params: nextParams,
|
|
1859
|
-
decoder: this.pathParamsDecoder,
|
|
1860
|
-
server: this.isServer,
|
|
1861
|
-
}).interpolatedPath
|
|
1862
|
-
|
|
1863
1855
|
// Use lightweight getMatchedRoutes instead of matchRoutesInternal
|
|
1864
1856
|
// This avoids creating full match objects (AbortController, ControlledPromise, etc.)
|
|
1865
1857
|
// which are expensive and not needed for buildLocation
|
|
1866
|
-
const destMatchResult = this.getMatchedRoutes(
|
|
1858
|
+
const destMatchResult = this.getMatchedRoutes(nextTo)
|
|
1867
1859
|
let destRoutes = destMatchResult.matchedRoutes
|
|
1868
1860
|
|
|
1869
1861
|
// Compute globalNotFoundRouteId using the same logic as matchRoutesInternal
|
|
1870
|
-
const isGlobalNotFound =
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1862
|
+
const isGlobalNotFound =
|
|
1863
|
+
!destMatchResult.foundRoute ||
|
|
1864
|
+
(destMatchResult.foundRoute.path !== '/' &&
|
|
1865
|
+
destMatchResult.routeParams['**'])
|
|
1874
1866
|
|
|
1875
1867
|
if (isGlobalNotFound && this.options.notFoundRoute) {
|
|
1876
1868
|
destRoutes = [...destRoutes, this.options.notFoundRoute]
|
|
1877
1869
|
}
|
|
1878
1870
|
|
|
1879
1871
|
// If there are any params, we need to stringify them
|
|
1880
|
-
let changedParams = false
|
|
1881
1872
|
if (Object.keys(nextParams).length > 0) {
|
|
1882
1873
|
for (const route of destRoutes) {
|
|
1883
1874
|
const fn =
|
|
@@ -1885,7 +1876,6 @@ export class RouterCore<
|
|
|
1885
1876
|
if (fn) {
|
|
1886
1877
|
try {
|
|
1887
1878
|
Object.assign(nextParams, fn(nextParams))
|
|
1888
|
-
changedParams = true
|
|
1889
1879
|
} catch {
|
|
1890
1880
|
// Ignore errors here. When a paired parseParams is defined,
|
|
1891
1881
|
// extractStrictParams will re-throw during route matching,
|
|
@@ -1902,14 +1892,12 @@ export class RouterCore<
|
|
|
1902
1892
|
// This preserves the original parameter syntax including optional parameters
|
|
1903
1893
|
nextTo
|
|
1904
1894
|
: decodePath(
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
:
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
server: this.isServer,
|
|
1912
|
-
}).interpolatedPath,
|
|
1895
|
+
interpolatePath({
|
|
1896
|
+
path: nextTo,
|
|
1897
|
+
params: nextParams,
|
|
1898
|
+
decoder: this.pathParamsDecoder,
|
|
1899
|
+
server: this.isServer,
|
|
1900
|
+
}).interpolatedPath,
|
|
1913
1901
|
).path
|
|
1914
1902
|
|
|
1915
1903
|
// Resolve the next search
|