@solidjs/router 0.14.3 → 0.14.5

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.
@@ -62,7 +62,7 @@ export function cache(fn, name) {
62
62
  const data = e && (e.router.data || (e.router.data = {}));
63
63
  if (data && key in data)
64
64
  return data[key];
65
- if (Array.isArray(dataOnly) && !dataOnly.includes(key)) {
65
+ if (Array.isArray(dataOnly) && !matchKey(key, dataOnly)) {
66
66
  data[key] = undefined;
67
67
  return Promise.resolve();
68
68
  }
package/dist/index.js CHANGED
@@ -532,8 +532,7 @@ function createRouterContext(integration, branches, getContext, options = {}) {
532
532
  scroll: true,
533
533
  ...options
534
534
  };
535
- let s;
536
- const resolvedTo = resolve ? route.resolvePath(to) : resolvePath(queryOnly && (s = source().value) && s.split("?")[0] || "", to);
535
+ const resolvedTo = resolve ? route.resolvePath(to) : resolvePath(queryOnly && location.pathname || "", to);
537
536
  if (resolvedTo === undefined) {
538
537
  throw new Error(`Path '${to}' is not a routable path`);
539
538
  } else if (referrers.length >= MAX_REDIRECTS) {
@@ -940,7 +939,7 @@ function cache(fn, name) {
940
939
  if (dataOnly) {
941
940
  const data = e && (e.router.data || (e.router.data = {}));
942
941
  if (data && key in data) return data[key];
943
- if (Array.isArray(dataOnly) && !dataOnly.includes(key)) {
942
+ if (Array.isArray(dataOnly) && !matchKey(key, dataOnly)) {
944
943
  data[key] = undefined;
945
944
  return Promise.resolve();
946
945
  }
@@ -1316,9 +1315,10 @@ function Router(props) {
1316
1315
  if (isServer) return StaticRouter(props);
1317
1316
  const getSource = () => {
1318
1317
  const url = window.location.pathname.replace(/^\/+/, "/") + window.location.search;
1318
+ const state = window.history.state && window.history.state._depth && Object.keys(window.history.state).length === 1 ? undefined : window.history.state;
1319
1319
  return {
1320
1320
  value: url + window.location.hash,
1321
- state: window.history.state
1321
+ state
1322
1322
  };
1323
1323
  };
1324
1324
  const beforeLeave = createBeforeLeave();
@@ -8,9 +8,10 @@ export function Router(props) {
8
8
  return StaticRouter(props);
9
9
  const getSource = () => {
10
10
  const url = window.location.pathname.replace(/^\/+/, "/") + window.location.search;
11
+ const state = window.history.state && window.history.state._depth && Object.keys(window.history.state).length === 1 ? undefined : window.history.state;
11
12
  return {
12
13
  value: url + window.location.hash,
13
- state: window.history.state
14
+ state
14
15
  };
15
16
  };
16
17
  const beforeLeave = createBeforeLeave();
package/dist/routing.js CHANGED
@@ -305,7 +305,7 @@ export function createRouterContext(integration, branches, getContext, options =
305
305
  let s;
306
306
  const resolvedTo = resolve
307
307
  ? route.resolvePath(to)
308
- : resolvePath((queryOnly && (s = source().value) && s.split("?")[0]) || "", to);
308
+ : resolvePath((queryOnly && location.pathname) || "", to);
309
309
  if (resolvedTo === undefined) {
310
310
  throw new Error(`Path '${to}' is not a routable path`);
311
311
  }
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "Ryan Turnquist"
7
7
  ],
8
8
  "license": "MIT",
9
- "version": "0.14.3",
9
+ "version": "0.14.5",
10
10
  "homepage": "https://github.com/solidjs/solid-router#readme",
11
11
  "repository": {
12
12
  "type": "git",