@tanstack/router-core 1.154.14 → 1.155.0

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.
@@ -2,7 +2,7 @@ import { Store, batch } from "@tanstack/store";
2
2
  import { createBrowserHistory, parseHref } from "@tanstack/history";
3
3
  import { createControlledPromise, isDangerousProtocol, deepEqual, replaceEqualDeep, decodePath, functionalUpdate, last, findLast } from "./utils.js";
4
4
  import { processRouteTree, processRouteMasks, findSingleMatch, findRouteMatch, findFlatMatch } from "./new-process-route-tree.js";
5
- import { trimPath, resolvePath, cleanPath, trimPathRight, interpolatePath } from "./path.js";
5
+ import { compileDecodeCharMap, trimPath, resolvePath, cleanPath, trimPathRight, interpolatePath } from "./path.js";
6
6
  import { createLRUCache } from "./lru-cache.js";
7
7
  import { isNotFound } from "./not-found.js";
8
8
  import { setupScrollRestoration } from "./scroll-restoration.js";
@@ -69,12 +69,10 @@ class RouterCore {
69
69
  ...newOptions
70
70
  };
71
71
  this.isServer = this.options.isServer ?? typeof document === "undefined";
72
- this.pathParamsDecodeCharMap = this.options.pathParamsAllowedCharacters ? new Map(
73
- this.options.pathParamsAllowedCharacters.map((char) => [
74
- encodeURIComponent(char),
75
- char
76
- ])
77
- ) : void 0;
72
+ if (this.options.pathParamsAllowedCharacters)
73
+ this.pathParamsDecoder = compileDecodeCharMap(
74
+ this.options.pathParamsAllowedCharacters
75
+ );
78
76
  if (!this.history || this.options.history && this.options.history !== this.history) {
79
77
  if (!this.options.history) {
80
78
  if (!this.isServer) {
@@ -344,7 +342,7 @@ class RouterCore {
344
342
  interpolatePath({
345
343
  path: nextTo,
346
344
  params: nextParams,
347
- decodeCharMap: this.pathParamsDecodeCharMap
345
+ decoder: this.pathParamsDecoder
348
346
  }).interpolatedPath
349
347
  );
350
348
  let nextSearch = fromSearch;
@@ -1097,7 +1095,7 @@ class RouterCore {
1097
1095
  const { interpolatedPath, usedParams } = interpolatePath({
1098
1096
  path: route.fullPath,
1099
1097
  params: routeParams,
1100
- decodeCharMap: this.pathParamsDecodeCharMap
1098
+ decoder: this.pathParamsDecoder
1101
1099
  });
1102
1100
  const matchId = (
1103
1101
  // route.id for disambiguation