@tanstack/router-core 1.157.13 → 1.157.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/router-core",
3
- "version": "1.157.13",
3
+ "version": "1.157.15",
4
4
  "description": "Modern and scalable routing for React applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -389,13 +389,6 @@ const executeBeforeLoad = (
389
389
 
390
390
  const abortController = new AbortController()
391
391
 
392
- const parentMatchId = inner.matches[index - 1]?.id
393
- const parentMatch = parentMatchId
394
- ? inner.router.getMatch(parentMatchId)!
395
- : undefined
396
- const parentMatchContext =
397
- parentMatch?.context ?? inner.router.options.context ?? undefined
398
-
399
392
  let isPending = false
400
393
  const pending = () => {
401
394
  if (isPending) return
package/src/router.ts CHANGED
@@ -1252,9 +1252,34 @@ export class RouterCore<
1252
1252
  previousLocation,
1253
1253
  ) => {
1254
1254
  const parse = ({
1255
+ pathname,
1256
+ search,
1257
+ hash,
1255
1258
  href,
1256
1259
  state,
1257
1260
  }: HistoryLocation): ParsedLocation<FullSearchSchema<TRouteTree>> => {
1261
+ // Fast path: no rewrite configured and pathname doesn't need encoding
1262
+ // Characters that need encoding: space, high unicode, control chars
1263
+ // eslint-disable-next-line no-control-regex
1264
+ if (!this.rewrite && !/[ \x00-\x1f\x7f\u0080-\uffff]/.test(pathname)) {
1265
+ const parsedSearch = this.options.parseSearch(search)
1266
+ const searchStr = this.options.stringifySearch(parsedSearch)
1267
+
1268
+ return {
1269
+ href: pathname + searchStr + hash,
1270
+ publicHref: href,
1271
+ pathname: decodePath(pathname),
1272
+ external: false,
1273
+ searchStr,
1274
+ search: replaceEqualDeep(
1275
+ previousLocation?.search,
1276
+ parsedSearch,
1277
+ ) as any,
1278
+ hash: decodePath(hash.slice(1)),
1279
+ state: replaceEqualDeep(previousLocation?.state, state),
1280
+ }
1281
+ }
1282
+
1258
1283
  // Before we do any processing, we need to allow rewrites to modify the URL
1259
1284
  // build up the full URL by combining the href from history with the router's origin
1260
1285
  const fullUrl = new URL(href, this.origin)
@@ -1276,7 +1301,7 @@ export class RouterCore<
1276
1301
  external: !!this.rewrite && url.origin !== this.origin,
1277
1302
  searchStr,
1278
1303
  search: replaceEqualDeep(previousLocation?.search, parsedSearch) as any,
1279
- hash: decodePath(url.hash.split('#').reverse()[0] ?? ''),
1304
+ hash: decodePath(url.hash.slice(1)),
1280
1305
  state: replaceEqualDeep(previousLocation?.state, state),
1281
1306
  }
1282
1307
  }