Repository navigation
v2.0.0-next.38
Pre-releasePatch Changes
-
457ac72: Claimed anchors share one parse of the location and base path instead of
re-parsing both per anchor, roughly halving theURLconstructions link
state does at load and on every navigation sweep. -
fb43a9c: Link preloading on
focusinandtouchstartnow works. Both went through the click handler's primary-button gate, whichFocusEventandTouchEventnever pass, so only a resting mouse pointer preloaded. Preload triggers now find the anchor without the button and modifier-key checks; click handling is unchanged. -
9618caa: Link preloading is now pluggable and opt-in. Breaking: the router no longer preloads on hover, focus, or touch by default; pass a strategy to restore it:
import { createRouter, intentPreload } from "@solidjs/router"; const Router = createRouter({ routes, preloadLinks: intentPreload() });
preloadLinkstakes a strategy or an array of strategies instead of a boolean. A boolean is a type error, warns in development, and preloads nothing.intentPreload({ delay = 20, data = true })is the previous behavior: preload when the pointer rests on a link fordelayms, on focus, and on touchstart.data: falsewarms route code only.preload="false"on a link now opts it out of preloading entirely. Previously it still preloaded the route's code and skipped only its data.transformUrlnow applies inside route preloading itself, so preloads match the same pathname navigation does, includingusePreloadRoutecalls, which previously matched the untransformed URL.
Apps that don't preload links no longer ship the hover/focus/touch listeners.
-
b9594e9: Route preloading (matching a link's URL, loading lazy components and subtrees, running
preloadfunctions withintent: "preload") moved out of the router core into its own module. Only link preload strategies andusePreloadRouteimport it, so apps that use neither no longer ship it. No behavior change. -
e493aae: Smaller link-preload strategies, with the same behavior.
intentPreloadandtapPreloadregister their listeners directly instead of through shared wrappers, andusePreloadRouteno longer allocates an options object when called with a URL alone. -
dce7819: Include the server-component form fallback only when
__SOLID_SERVER_COMPONENTS__is true, so apps without server components drop that code. -
54f4f5a: New link preload strategies for
createRouter({ preloadLinks }), combinable withintentPreload()in an array:tapPreload({ data = true })preloads a link onpointerdown, ahead of its click.viewportPreload({ all, data = false, delay = 100, rootMargin })preloads a link once it has stayed in the viewport fordelayms, when the browser is next idle. Each link preloads once, and again after itshrefchanges; links that leave before then are dropped. OneIntersectionObserveris shared by every link.eagerPreload({ all, data = false })preloads links once the page has loaded and the browser is idle, including links mounted later.
The viewport and eager strategies apply to links marked
preload="viewport"orpreload="eager", or with{ all: true }to every router link exceptpreload="false"ones. They preload route code only unless created withdata: true, and skip preloading when the browser reports Save-Data or a 2g connection.