@solidjs/router 0.14.2 → 0.14.3
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/dist/data/createAsync.js +2 -2
- package/dist/index.js +9 -8
- package/dist/routers/Router.js +1 -1
- package/dist/routers/StaticRouter.js +1 -2
- package/dist/routing.js +7 -3
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/data/createAsync.js
CHANGED
|
@@ -33,13 +33,13 @@ export function createAsyncStore(fn, options = {}) {
|
|
|
33
33
|
}
|
|
34
34
|
function createDeepSignal(value, options) {
|
|
35
35
|
const [store, setStore] = createStore({
|
|
36
|
-
value
|
|
36
|
+
value: structuredClone(value)
|
|
37
37
|
});
|
|
38
38
|
return [
|
|
39
39
|
() => store.value,
|
|
40
40
|
(v) => {
|
|
41
41
|
typeof v === "function" && (v = v());
|
|
42
|
-
setStore("value", reconcile(v, options));
|
|
42
|
+
setStore("value", reconcile(structuredClone(v), options));
|
|
43
43
|
return store.value;
|
|
44
44
|
}
|
|
45
45
|
];
|
package/dist/index.js
CHANGED
|
@@ -263,7 +263,7 @@ const useSearchParams = () => {
|
|
|
263
263
|
const location = useLocation();
|
|
264
264
|
const navigate = useNavigate();
|
|
265
265
|
const setSearchParams = (params, options) => {
|
|
266
|
-
const searchString = untrack(() =>
|
|
266
|
+
const searchString = untrack(() => mergeSearchString(location.search, params) + location.hash);
|
|
267
267
|
navigate(searchString, {
|
|
268
268
|
scroll: false,
|
|
269
269
|
resolve: false,
|
|
@@ -520,6 +520,7 @@ function createRouterContext(integration, branches, getContext, options = {}) {
|
|
|
520
520
|
}
|
|
521
521
|
return;
|
|
522
522
|
}
|
|
523
|
+
const queryOnly = !to || to[0] === "?";
|
|
523
524
|
const {
|
|
524
525
|
replace,
|
|
525
526
|
resolve,
|
|
@@ -527,11 +528,12 @@ function createRouterContext(integration, branches, getContext, options = {}) {
|
|
|
527
528
|
state: nextState
|
|
528
529
|
} = {
|
|
529
530
|
replace: false,
|
|
530
|
-
resolve:
|
|
531
|
+
resolve: !queryOnly,
|
|
531
532
|
scroll: true,
|
|
532
533
|
...options
|
|
533
534
|
};
|
|
534
|
-
|
|
535
|
+
let s;
|
|
536
|
+
const resolvedTo = resolve ? route.resolvePath(to) : resolvePath(queryOnly && (s = source().value) && s.split("?")[0] || "", to);
|
|
535
537
|
if (resolvedTo === undefined) {
|
|
536
538
|
throw new Error(`Path '${to}' is not a routable path`);
|
|
537
539
|
} else if (referrers.length >= MAX_REDIRECTS) {
|
|
@@ -873,9 +875,8 @@ function getPath(url) {
|
|
|
873
875
|
}
|
|
874
876
|
function StaticRouter(props) {
|
|
875
877
|
let e;
|
|
876
|
-
const url = props.url || (e = getRequestEvent()) && getPath(e.request.url) || "";
|
|
877
878
|
const obj = {
|
|
878
|
-
value: props.
|
|
879
|
+
value: props.url || (e = getRequestEvent()) && getPath(e.request.url) || ""
|
|
879
880
|
};
|
|
880
881
|
return createRouterComponent({
|
|
881
882
|
signal: [() => obj, next => Object.assign(obj, next)]
|
|
@@ -1316,7 +1317,7 @@ function Router(props) {
|
|
|
1316
1317
|
const getSource = () => {
|
|
1317
1318
|
const url = window.location.pathname.replace(/^\/+/, "/") + window.location.search;
|
|
1318
1319
|
return {
|
|
1319
|
-
value:
|
|
1320
|
+
value: url + window.location.hash,
|
|
1320
1321
|
state: window.history.state
|
|
1321
1322
|
};
|
|
1322
1323
|
};
|
|
@@ -1558,11 +1559,11 @@ function createAsyncStore(fn, options = {}) {
|
|
|
1558
1559
|
}
|
|
1559
1560
|
function createDeepSignal(value, options) {
|
|
1560
1561
|
const [store, setStore] = createStore({
|
|
1561
|
-
value
|
|
1562
|
+
value: structuredClone(value)
|
|
1562
1563
|
});
|
|
1563
1564
|
return [() => store.value, v => {
|
|
1564
1565
|
typeof v === "function" && (v = v());
|
|
1565
|
-
setStore("value", reconcile(v, options));
|
|
1566
|
+
setStore("value", reconcile(structuredClone(v), options));
|
|
1566
1567
|
return store.value;
|
|
1567
1568
|
}];
|
|
1568
1569
|
}
|
package/dist/routers/Router.js
CHANGED
|
@@ -9,7 +9,7 @@ export function Router(props) {
|
|
|
9
9
|
const getSource = () => {
|
|
10
10
|
const url = window.location.pathname.replace(/^\/+/, "/") + window.location.search;
|
|
11
11
|
return {
|
|
12
|
-
value:
|
|
12
|
+
value: url + window.location.hash,
|
|
13
13
|
state: window.history.state
|
|
14
14
|
};
|
|
15
15
|
};
|
|
@@ -6,9 +6,8 @@ function getPath(url) {
|
|
|
6
6
|
}
|
|
7
7
|
export function StaticRouter(props) {
|
|
8
8
|
let e;
|
|
9
|
-
const url = props.url || ((e = getRequestEvent()) && getPath(e.request.url)) || "";
|
|
10
9
|
const obj = {
|
|
11
|
-
value: props.
|
|
10
|
+
value: props.url || ((e = getRequestEvent()) && getPath(e.request.url)) || "",
|
|
12
11
|
};
|
|
13
12
|
return createRouterComponent({
|
|
14
13
|
signal: [() => obj, next => Object.assign(obj, next)]
|
package/dist/routing.js
CHANGED
|
@@ -41,7 +41,7 @@ export const useSearchParams = () => {
|
|
|
41
41
|
const location = useLocation();
|
|
42
42
|
const navigate = useNavigate();
|
|
43
43
|
const setSearchParams = (params, options) => {
|
|
44
|
-
const searchString = untrack(() =>
|
|
44
|
+
const searchString = untrack(() => mergeSearchString(location.search, params) + location.hash);
|
|
45
45
|
navigate(searchString, {
|
|
46
46
|
scroll: false,
|
|
47
47
|
resolve: false,
|
|
@@ -295,13 +295,17 @@ export function createRouterContext(integration, branches, getContext, options =
|
|
|
295
295
|
}
|
|
296
296
|
return;
|
|
297
297
|
}
|
|
298
|
+
const queryOnly = !to || to[0] === "?";
|
|
298
299
|
const { replace, resolve, scroll, state: nextState } = {
|
|
299
300
|
replace: false,
|
|
300
|
-
resolve:
|
|
301
|
+
resolve: !queryOnly,
|
|
301
302
|
scroll: true,
|
|
302
303
|
...options
|
|
303
304
|
};
|
|
304
|
-
|
|
305
|
+
let s;
|
|
306
|
+
const resolvedTo = resolve
|
|
307
|
+
? route.resolvePath(to)
|
|
308
|
+
: resolvePath((queryOnly && (s = source().value) && s.split("?")[0]) || "", to);
|
|
305
309
|
if (resolvedTo === undefined) {
|
|
306
310
|
throw new Error(`Path '${to}' is not a routable path`);
|
|
307
311
|
}
|
package/dist/types.d.ts
CHANGED