@solidjs/router
Advanced tools
Comparing version 0.14.8 to 0.14.9
@@ -187,3 +187,3 @@ import { createSignal, getListener, getOwner, onCleanup, sharedConfig, startTransition } from "solid-js"; | ||
for (let k of keys) { | ||
if (key.startsWith(k)) | ||
if (k && key.startsWith(k)) | ||
return true; | ||
@@ -190,0 +190,0 @@ } |
@@ -62,3 +62,3 @@ import { delegateEvents } from "solid-js/web"; | ||
transformUrl && (url.pathname = transformUrl(url.pathname)); | ||
router.preloadRoute(url, { preloadData: a.getAttribute("preload") !== "false" }); | ||
router.preloadRoute(url, a.getAttribute("preload") !== "false"); | ||
} | ||
@@ -75,3 +75,3 @@ function handleAnchorMove(evt) { | ||
preloadTimeout = setTimeout(() => { | ||
router.preloadRoute(url, { preloadData: a.getAttribute("preload") !== "false" }); | ||
router.preloadRoute(url, a.getAttribute("preload") !== "false"); | ||
lastElement = a; | ||
@@ -78,0 +78,0 @@ }, 20); |
@@ -15,3 +15,3 @@ export function redirect(url, init = 302) { | ||
headers.set("Location", url); | ||
revalidate && headers.set("X-Revalidate", revalidate.toString()); | ||
revalidate !== undefined && headers.set("X-Revalidate", revalidate.toString()); | ||
const response = new Response(null, { | ||
@@ -26,3 +26,3 @@ ...responseInit, | ||
const headers = new Headers(responseInit.headers); | ||
revalidate && headers.set("X-Revalidate", revalidate.toString()); | ||
revalidate !== undefined && headers.set("X-Revalidate", revalidate.toString()); | ||
return new Response(null, { | ||
@@ -36,3 +36,3 @@ ...responseInit, | ||
const headers = new Headers(responseInit.headers); | ||
revalidate && headers.set("X-Revalidate", revalidate.toString()); | ||
revalidate !== undefined && headers.set("X-Revalidate", revalidate.toString()); | ||
headers.set("Content-Type", "application/json"); | ||
@@ -39,0 +39,0 @@ const response = new Response(JSON.stringify(data), { |
@@ -247,3 +247,6 @@ import { isServer, getRequestEvent, createComponent as createComponent$1, memo, delegateEvents, spread, mergeProps as mergeProps$1, template } from 'solid-js/web'; | ||
const useIsRouting = () => useRouter().isRouting; | ||
const usePreloadRoute = () => useRouter().preloadRoute; | ||
const usePreloadRoute = () => { | ||
const pre = useRouter().preloadRoute; | ||
return (url, options = {}) => pre(url instanceof URL ? url : new URL(url, mockBase), options.preloadData); | ||
}; | ||
const useMatch = (path, matchFilters) => { | ||
@@ -589,3 +592,3 @@ const location = useLocation(); | ||
} | ||
function preloadRoute(url, options = {}) { | ||
function preloadRoute(url, preloadData) { | ||
const matches = getRouteMatches(branches(), url.pathname); | ||
@@ -604,3 +607,3 @@ const prevIntent = intent; | ||
inPreloadFn = true; | ||
options.preloadData && preload && runWithOwner(getContext(), () => preload({ | ||
preloadData && preload && runWithOwner(getContext(), () => preload({ | ||
params, | ||
@@ -1038,3 +1041,3 @@ location: { | ||
for (let k of keys) { | ||
if (key.startsWith(k)) return true; | ||
if (k && key.startsWith(k)) return true; | ||
} | ||
@@ -1233,5 +1236,3 @@ return false; | ||
transformUrl && (url.pathname = transformUrl(url.pathname)); | ||
router.preloadRoute(url, { | ||
preloadData: a.getAttribute("preload") !== "false" | ||
}); | ||
router.preloadRoute(url, a.getAttribute("preload") !== "false"); | ||
} | ||
@@ -1246,5 +1247,3 @@ function handleAnchorMove(evt) { | ||
preloadTimeout = setTimeout(() => { | ||
router.preloadRoute(url, { | ||
preloadData: a.getAttribute("preload") !== "false" | ||
}); | ||
router.preloadRoute(url, a.getAttribute("preload") !== "false"); | ||
lastElement = a; | ||
@@ -1621,3 +1620,3 @@ }, 20); | ||
headers.set("Location", url); | ||
revalidate && headers.set("X-Revalidate", revalidate.toString()); | ||
revalidate !== undefined && headers.set("X-Revalidate", revalidate.toString()); | ||
const response = new Response(null, { | ||
@@ -1635,3 +1634,3 @@ ...responseInit, | ||
const headers = new Headers(responseInit.headers); | ||
revalidate && headers.set("X-Revalidate", revalidate.toString()); | ||
revalidate !== undefined && headers.set("X-Revalidate", revalidate.toString()); | ||
return new Response(null, { | ||
@@ -1648,3 +1647,3 @@ ...responseInit, | ||
const headers = new Headers(responseInit.headers); | ||
revalidate && headers.set("X-Revalidate", revalidate.toString()); | ||
revalidate !== undefined && headers.set("X-Revalidate", revalidate.toString()); | ||
headers.set("Content-Type", "application/json"); | ||
@@ -1651,0 +1650,0 @@ const response = new Response(JSON.stringify(data), { |
@@ -12,4 +12,4 @@ import { JSX, Accessor } from "solid-js"; | ||
export declare const useIsRouting: () => () => boolean; | ||
export declare const usePreloadRoute: () => (url: URL, options: { | ||
preloadData?: boolean | undefined; | ||
export declare const usePreloadRoute: () => (url: string | URL, options?: { | ||
preloadData?: boolean; | ||
}) => void; | ||
@@ -16,0 +16,0 @@ export declare const useMatch: <S extends string>(path: () => S, matchFilters?: MatchFilters<S> | undefined) => Accessor<import("./types.js").PathMatch | undefined>; |
@@ -26,3 +26,6 @@ import { runWithOwner, batch } from "solid-js"; | ||
export const useIsRouting = () => useRouter().isRouting; | ||
export const usePreloadRoute = () => useRouter().preloadRoute; | ||
export const usePreloadRoute = () => { | ||
const pre = useRouter().preloadRoute; | ||
return (url, options = {}) => pre(url instanceof URL ? url : new URL(url, mockBase), options.preloadData); | ||
}; | ||
export const useMatch = (path, matchFilters) => { | ||
@@ -352,3 +355,3 @@ const location = useLocation(); | ||
} | ||
function preloadRoute(url, options = {}) { | ||
function preloadRoute(url, preloadData) { | ||
const matches = getRouteMatches(branches(), url.pathname); | ||
@@ -364,3 +367,3 @@ const prevIntent = intent; | ||
inPreloadFn = true; | ||
options.preloadData && | ||
preloadData && | ||
preload && | ||
@@ -367,0 +370,0 @@ runWithOwner(getContext(), () => preload({ |
@@ -142,5 +142,3 @@ import type { Component, JSX, Signal } from "solid-js"; | ||
beforeLeave: BeforeLeaveLifecycle; | ||
preloadRoute: (url: URL, options: { | ||
preloadData?: boolean; | ||
}) => void; | ||
preloadRoute: (url: URL, preloadData?: boolean) => void; | ||
singleFlight: boolean; | ||
@@ -147,0 +145,0 @@ submissions: Signal<Submission<any, any>[]>; |
@@ -9,3 +9,3 @@ { | ||
"license": "MIT", | ||
"version": "0.14.8", | ||
"version": "0.14.9", | ||
"homepage": "https://github.com/solidjs/solid-router#readme", | ||
@@ -12,0 +12,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
171658
1