@tanstack/react-router
Advanced tools
Comparing version 1.39.6 to 1.39.7
@@ -121,6 +121,15 @@ import { last } from "./utils.js"; | ||
const interpolatedPathSegments = parsePathname(path); | ||
const encodedParams = {}; | ||
for (const [key, value] of Object.entries(params)) { | ||
const isValueString = typeof value === "string"; | ||
if (["*", "_splat"].includes(key)) { | ||
encodedParams[key] = isValueString ? encodeURI(value) : value; | ||
} else { | ||
encodedParams[key] = isValueString ? encodeURIComponent(value) : value; | ||
} | ||
} | ||
return joinPaths( | ||
interpolatedPathSegments.map((segment) => { | ||
if (segment.type === "wildcard") { | ||
const value = params._splat; | ||
const value = encodedParams._splat; | ||
if (leaveWildcards) | ||
@@ -132,6 +141,6 @@ return `${segment.value}${value ?? ""}`; | ||
if (leaveParams) { | ||
const value = params[segment.value]; | ||
const value = encodedParams[segment.value]; | ||
return `${segment.value}${value ?? ""}`; | ||
} | ||
return params[segment.value.substring(1)] ?? "undefined"; | ||
return encodedParams[segment.value.substring(1)] ?? "undefined"; | ||
} | ||
@@ -138,0 +147,0 @@ return segment.value; |
@@ -433,9 +433,2 @@ import { createBrowserHistory, createMemoryHistory } from "@tanstack/history"; | ||
} | ||
Object.keys(nextParams).forEach((key) => { | ||
if (["*", "_splat"].includes(key)) { | ||
nextParams[key] = encodeURI(nextParams[key]); | ||
} else { | ||
nextParams[key] = encodeURIComponent(nextParams[key]); | ||
} | ||
}); | ||
pathname = interpolatePath({ | ||
@@ -442,0 +435,0 @@ path: pathname, |
{ | ||
"name": "@tanstack/react-router", | ||
"version": "1.39.6", | ||
"version": "1.39.7", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "author": "Tanner Linsley", |
@@ -208,7 +208,19 @@ import { last } from './utils' | ||
const interpolatedPathSegments = parsePathname(path) | ||
const encodedParams: any = {} | ||
for (const [key, value] of Object.entries(params)) { | ||
const isValueString = typeof value === 'string' | ||
if (['*', '_splat'].includes(key)) { | ||
// the splat/catch-all routes shouldn't have the '/' encoded out | ||
encodedParams[key] = isValueString ? encodeURI(value) : value | ||
} else { | ||
encodedParams[key] = isValueString ? encodeURIComponent(value) : value | ||
} | ||
} | ||
return joinPaths( | ||
interpolatedPathSegments.map((segment) => { | ||
if (segment.type === 'wildcard') { | ||
const value = params._splat | ||
const value = encodedParams._splat | ||
if (leaveWildcards) return `${segment.value}${value ?? ''}` | ||
@@ -220,6 +232,6 @@ return value | ||
if (leaveParams) { | ||
const value = params[segment.value] | ||
const value = encodedParams[segment.value] | ||
return `${segment.value}${value ?? ''}` | ||
} | ||
return params![segment.value.substring(1)] ?? 'undefined' | ||
return encodedParams![segment.value.substring(1)] ?? 'undefined' | ||
} | ||
@@ -226,0 +238,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1382172
16935