@solidjs/router 0.10.7 → 0.10.9

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.
@@ -57,7 +57,7 @@ export function cache(fn, name, options) {
57
57
  const key = name + hashKey(args);
58
58
  let cached = cache.get(key);
59
59
  let version;
60
- if (owner) {
60
+ if (owner && !isServer) {
61
61
  version = createSignal(now, {
62
62
  equals: (p, v) => v - p < 50 // margin of error
63
63
  });
@@ -70,12 +70,12 @@ export function cache(fn, name, options) {
70
70
  cached[0] = now;
71
71
  }
72
72
  let res = cached[1];
73
- if (!isServer && intent !== "preload") {
73
+ if (intent !== "preload") {
74
74
  res =
75
75
  "then" in cached[1]
76
76
  ? cached[1].then(handleResponse(false), handleResponse(true))
77
77
  : handleResponse(false)(cached[1]);
78
- intent === "navigate" && startTransition(() => revalidateSignals(cached[3], cached[0])); // update version
78
+ !isServer && intent === "navigate" && startTransition(() => revalidateSignals(cached[3], cached[0])); // update version
79
79
  }
80
80
  return res;
81
81
  }
package/dist/index.js CHANGED
@@ -255,7 +255,10 @@ function createRoutes(routeDef, base = "") {
255
255
  return asArray(routeDef.path).reduce((acc, path) => {
256
256
  for (const originalPath of expandOptionals(path)) {
257
257
  const path = joinPaths(base, originalPath);
258
- const pattern = isLeaf ? path : path.split("/*", 1)[0];
258
+ let pattern = isLeaf ? path : path.split("/*", 1)[0];
259
+ pattern = pattern.split("/").map(s => {
260
+ return s.startsWith(':') || s.startsWith('*') ? s : encodeURIComponent(s);
261
+ }).join("/");
259
262
  acc.push({
260
263
  ...shared,
261
264
  originalPath,
@@ -818,7 +821,7 @@ function cache(fn, name, options) {
818
821
  const key = name + hashKey(args);
819
822
  let cached = cache.get(key);
820
823
  let version;
821
- if (owner) {
824
+ if (owner && !isServer) {
822
825
  version = createSignal(now, {
823
826
  equals: (p, v) => v - p < 50 // margin of error
824
827
  });
@@ -833,9 +836,9 @@ function cache(fn, name, options) {
833
836
  cached[0] = now;
834
837
  }
835
838
  let res = cached[1];
836
- if (!isServer && intent !== "preload") {
839
+ if (intent !== "preload") {
837
840
  res = "then" in cached[1] ? cached[1].then(handleResponse(false), handleResponse(true)) : handleResponse(false)(cached[1]);
838
- intent === "navigate" && startTransition(() => revalidateSignals(cached[3], cached[0])); // update version
841
+ !isServer && intent === "navigate" && startTransition(() => revalidateSignals(cached[3], cached[0])); // update version
839
842
  }
840
843
 
841
844
  return res;
package/dist/routing.js CHANGED
@@ -67,7 +67,10 @@ export function createRoutes(routeDef, base = "") {
67
67
  return asArray(routeDef.path).reduce((acc, path) => {
68
68
  for (const originalPath of expandOptionals(path)) {
69
69
  const path = joinPaths(base, originalPath);
70
- const pattern = isLeaf ? path : path.split("/*", 1)[0];
70
+ let pattern = isLeaf ? path : path.split("/*", 1)[0];
71
+ pattern = pattern.split("/").map((s) => {
72
+ return (s.startsWith(':') || s.startsWith('*')) ? s : encodeURIComponent(s);
73
+ }).join("/");
71
74
  acc.push({
72
75
  ...shared,
73
76
  originalPath,
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "Ryan Turnquist"
7
7
  ],
8
8
  "license": "MIT",
9
- "version": "0.10.7",
9
+ "version": "0.10.9",
10
10
  "homepage": "https://github.com/solidjs/solid-router#readme",
11
11
  "repository": {
12
12
  "type": "git",