@solidjs/router 0.12.3 → 0.12.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.
- package/README.md +1 -1
- package/dist/data/cache.js +4 -3
- package/dist/index.js +3 -4
- package/dist/routing.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -59,7 +59,7 @@ This sets up a Router that will match on the url to display the desired page
|
|
|
59
59
|
|
|
60
60
|
Solid Router allows you to configure your routes using JSX:
|
|
61
61
|
|
|
62
|
-
1. Add each route to a `<Router>` using the `Route` component, specifying a path and
|
|
62
|
+
1. Add each route to a `<Router>` using the `Route` component, specifying a path and a component to render when the user navigates to that path.
|
|
63
63
|
|
|
64
64
|
```jsx
|
|
65
65
|
import { render } from "solid-js/web";
|
package/dist/data/cache.js
CHANGED
|
@@ -73,9 +73,10 @@ export function cache(fn, name) {
|
|
|
73
73
|
onCleanup(() => cached[3].count--);
|
|
74
74
|
}
|
|
75
75
|
if (cached &&
|
|
76
|
+
cached[0] &&
|
|
76
77
|
(isServer ||
|
|
77
78
|
intent === "native" ||
|
|
78
|
-
|
|
79
|
+
cached[3].count ||
|
|
79
80
|
Date.now() - cached[0] < PRELOAD_TIMEOUT)) {
|
|
80
81
|
if (tracking) {
|
|
81
82
|
cached[3].count++;
|
|
@@ -113,8 +114,8 @@ export function cache(fn, name) {
|
|
|
113
114
|
}
|
|
114
115
|
if (isServer) {
|
|
115
116
|
const e = getRequestEvent();
|
|
116
|
-
e && e.router.dataOnly
|
|
117
|
-
|
|
117
|
+
if (e && e.router.dataOnly)
|
|
118
|
+
return (e.router.data[key] = res);
|
|
118
119
|
}
|
|
119
120
|
if (intent !== "preload") {
|
|
120
121
|
res =
|
package/dist/index.js
CHANGED
|
@@ -230,7 +230,7 @@ function expandOptionals(pattern) {
|
|
|
230
230
|
const MAX_REDIRECTS = 100;
|
|
231
231
|
const RouterContextObj = createContext();
|
|
232
232
|
const RouteContextObj = createContext();
|
|
233
|
-
const useRouter = () => invariant(useContext(RouterContextObj), "
|
|
233
|
+
const useRouter = () => invariant(useContext(RouterContextObj), "<A> and 'use' router primitives can be only used inside a Route.");
|
|
234
234
|
const useRoute = () => useContext(RouteContextObj) || useRouter().base;
|
|
235
235
|
const useResolvedPath = path => {
|
|
236
236
|
const route = useRoute();
|
|
@@ -913,7 +913,7 @@ function cache(fn, name) {
|
|
|
913
913
|
tracking = true;
|
|
914
914
|
onCleanup(() => cached[3].count--);
|
|
915
915
|
}
|
|
916
|
-
if (cached && (isServer || intent === "native" || cached[
|
|
916
|
+
if (cached && cached[0] && (isServer || intent === "native" || cached[3].count || Date.now() - cached[0] < PRELOAD_TIMEOUT)) {
|
|
917
917
|
if (tracking) {
|
|
918
918
|
cached[3].count++;
|
|
919
919
|
cached[3][0](); // track
|
|
@@ -945,8 +945,7 @@ function cache(fn, name) {
|
|
|
945
945
|
}
|
|
946
946
|
if (isServer) {
|
|
947
947
|
const e = getRequestEvent();
|
|
948
|
-
e && e.router.dataOnly
|
|
949
|
-
return res;
|
|
948
|
+
if (e && e.router.dataOnly) return e.router.data[key] = res;
|
|
950
949
|
}
|
|
951
950
|
if (intent !== "preload") {
|
|
952
951
|
res = "then" in res ? res.then(handleResponse(false), handleResponse(true)) : handleResponse(false)(res);
|
package/dist/routing.js
CHANGED
|
@@ -6,7 +6,7 @@ import { mockBase, createMemoObject, extractSearchParams, invariant, resolvePath
|
|
|
6
6
|
const MAX_REDIRECTS = 100;
|
|
7
7
|
export const RouterContextObj = createContext();
|
|
8
8
|
export const RouteContextObj = createContext();
|
|
9
|
-
export const useRouter = () => invariant(useContext(RouterContextObj), "
|
|
9
|
+
export const useRouter = () => invariant(useContext(RouterContextObj), "<A> and 'use' router primitives can be only used inside a Route.");
|
|
10
10
|
let TempRoute;
|
|
11
11
|
export const useRoute = () => TempRoute || useContext(RouteContextObj) || useRouter().base;
|
|
12
12
|
export const useResolvedPath = (path) => {
|