Repository navigation
Releases
v2.0.1
Patch Changes
- aae9ba5: Fix query() re-notifying consumers that read a preloaded entry during a navigation: the preload-to-read handoff now bumps the entry stamp and updates the entry's version signal once, before the reading scope tracks it, instead of re-bumping and re-writing a fresh stamp on every read (which made consuming memos re-run per flush pass and re-adopt the still-pending preload promise, surfacing as ABANDONED_FLIGHTS in dev attribution).
- dcb79ea: Keep a server-rendered read's
X-Revalidateheader off the SSR document response (#737).
v2.0.0
Major Changes
-
9b66caf: Remove the legacy component API. The
createRouterfactory (routes as config
objects, the instance as the provider component) is now the only way to set up
the router, and plain<a>elements — managed by the compiler-claimed anchor
integration — are the only link primitive.Removed:
<Router>,<HashRouter>,<MemoryRouter>,<StaticRouter>and the
createRouterComponentintegration wrapper. Use
createRouter({ routes, history })with thebrowserHistory(default),
hashHistory, ormemoryHistoryadapters; on the server the request URL
drives a static integration automatically.- JSX
<Route>(and itsRoutePropstype). Routes are config objects —
the single source of truth the typed path proxy infers from.
createFlightDataCollectorlikewise no longer accepts JSX trees; hand it
config objects, an array, a thunk, or a router instance. <A>andNavigate. Anchors are plain<a href>elements: the claims
integration appliesaria-current="page",data-active, and
data-pendingautomatically, anduseLinkStateremains the escape hatch
for custom client links. ForNavigate-style declarative redirects, call
useNavigate()in the route component or redirect from a preload.- The
createhook onRouterIntegration(only the legacy components
called it).
Renamed:
useCurrentMatchesis nowuseRouteMatches— same behavior, an accessor
of the router's resolved matches for the current location, outermost
first. The name draws the line againstuseMatch: one reflects the route
tree, the other tests a path pattern you supply.usePreloadRoutekeeps its name and now also accepts typed path nodes
(paths.users(2).settings) alongside strings and URLs.
hashParsermoved tosrc/routers/history.ts(exported for integrations);
createMemoryHistoryis replaced by thememoryHistory(initialPath)adapter,
which carriesgo/back/forward/listenfor tests and tools. -
0a1101a: Renumber the Solid 2 prerelease line from
1.0.0-next.*to2.0.0-next.*. The 0.16 line has been declared stable as1.0.0, so the 1.x majors now belong to the Solid 1 router; this line continues unchanged under 2.x, matching Solid 2's major. No code changes —2.0.0-next.12is the successor to1.0.0-next.11. If you track thenexttag with a^1.0.0-next.*range, update it to2.0.0-next.*or a stable1.xwill eventually satisfy it and hand you the Solid 1 router. -
d642c49: Begin the 1.0 API redesign: routes become config objects created outside JSX through a
createRouterfactory, and the route tree becomes the single source of truth for matching and types.createRouter({ routes, ... })returns an instance that is itself the provider component (<Router>{props => ...}</Router>); the render-prop child replaces therootprop and receives the matched content asprops.children. The factory'spreloadoption replacesrootPreload.Router.pathsis a typed path proxy derived from the route tree: property access descends static segments, calls bind params (paths.users(id).settings), and zero-arg or search-object calls terminate to a string (paths.search({ q, page })). Param types flow frommatchFilters(newintfilter types params as numbers) and search types from an optional per-route Standard Schemasearchvalidator. Every node coerces viatoString, andnavigate()/useParams()accept paths nodes.Router.match(url)matches arbitrary URLs against the instance with no rendering or request context — for middleware, sitemaps, and tests.- History adapters are imported values (
hashHistory(),memoryHistory(initialUrl?),browserHistory()) passed asconfig.history, so unused adapters never enter the bundle; the default is browser history on the client and the request URL on the server. - BREAKING: the low-level
createRouterintegration factory export is replaced by the new factory (custom integrations become history adapters). The JSX<Router>/<HashRouter>/<MemoryRouter>/<StaticRouter>components and<Route>remain for now and will be removed later in the 1.0 line. - Fixes
rootPreload's return value being dropped: the root section'sdataprop now receives the preload result.
Minor Changes
-
dff457e: Plain
<a>elements now carry link state automatically — no<A>wrapper needed. The Solid compiler claims everya[href]at creation and re-claims when a dynamichrefchanges; the router consumes those claims (for routers created throughcreateRouter) and maintains:aria-current="page"— the location matches the link exactlydata-active— exact or prefix match (root/matches exactly only)data-pending— the link is the target of an in-flight navigation
State is correct at creation, so late mounts (
<Show>,<For>, portals) are never stale, and it stays live per element with automatic disposal. External,targeted,download, andrel="external"links are left alone; withexplicitLinksonly anchors with thelinkattribute participate; base-path scoping matches click delegation. Style with CSS attribute selectors:nav a[aria-current="page"] { font-weight: 600; } nav a[data-active] { color: var(--accent); } a[data-pending] { opacity: 0.6; }
Typed path nodes are now valid
hrefvalues directly (<a href={paths.users(2)}>):TypedPathcarries the JSX serializable-attribute brand and SSR stringifies the node into markup.useLinkState's (and claimed anchors')pendingnow matches the in-flight navigation target explicitly instead of "active while routing", so it reads consistently from both pure computations and effects — effects observe the committed location during a transition and previously could never see the pending state.Requires the element-claim runtime from
@solidjs/web(dom-expressions 0.50.0-next.25+). -
Explicit scroll restoration for back/forward navigation is on by default (#577). Positions are captured per history entry (persisted across reloads) and restored once the navigation settles, retrying as the document grows when content commits late — replacing the browser heuristic that loses the saved offset whenever the destination route forces a layout while the document is still short. Opt out with
scrollRestoration: falsein thecreateRouterconfig. Customhistoryadapters own their session and are not wrapped implicitly; passscrollRestoration: trueto thread restoration through one. -
2abd13b: Add
defineRoutes, an identity helper with aconsttype parameter that
preserves route literal types for extracted route trees. Inline arrays passed
tocreateRouteralready infer literally;defineRoutesremoves the need
foras conston the common pattern of exporting the tree as a separate
value — and makes the silent type degradation of forgetting it impossible. -
c55d6bf: Forms submitted through delegation are marked
aria-busy="true"while their action is in flight — the form half of the attribute vocabulary links get (data-active/data-pending). The attribute covers the mutation and its response handling (revalidation included), survives overlapping submissions of the same form via a counter, and always clears, error or not. ProgrammaticuseActioncalls have no form and set nothing. Style with CSS:form[aria-busy] button { pointer-events: none; opacity: 0.6; }
-
0e06170: Add the
@solidjs/router/fsemission adapter:fileRoutes(entries)converts a neutralfilesystem-routingmanifest intoRouteDefinitions, wiringlazy()components (withmoduleUrlfor route assets) and spreadingrouteconfig, while preserving literal types soRoutePathskeeps working for typed navigation. -
08d35de: Lazy route subtrees:
childrenaccepts a thunk (children: () => import("./feature/routes")) so a section's route table loads on demand while staying part of the one typed tree. Types flow through the import's promise type intopathsand the typed hooks; hover-intent preloading kicks the table load and cascades into inner route preloads when it lands; navigation into an unresolved subtree folds the load into the transition (old screen holds); SSR and the single-flight collector resolve matched boundaries server-side. Resolution is cached per thunk and append-only. Async boundaries require the streaming render entry points (renderToStream/renderToStringAsync); the module'sdefaultorroutesexport (or a direct array) is used. -
ff75957: Add
useLinkState— reactiveactive/current/pendingstate for custom link components, the programmatic counterpart of the attribute vocabulary plain anchors will receive (aria-current,data-active,data-pending).<A>now derives its active/current state from it, so both share one semantics (trailing-slash and case handling,endfor exact-only). Accepts typed paths nodes as well as strings.createFlightDataCollectoralso accepts acreateRouterinstance directly: its routes, base, andpreloadare read off the instance config, so server wiring stays a one-liner (createFlightDataCollector(Router)). -
afc50c5: Update the router for the Solid 2 beta runtime and align its data APIs with the new async and action model.
This release removes deprecated async wrappers, updates action and submission behavior around Solid 2 actions, refreshes the documented optimistic patterns, and includes the related router/runtime compatibility changes needed for the beta branch.
-
6655835: Typed, parsed search params. Passing a paths node to
useSearchParams(paths.search)opts into Standard Schema parsing: the schemas of the currently matched routes run root→leaf over the raw query and their outputs merge over it, so reads return the schema's output type (defaults applied, values coerced) and the setter is ...
v1.0.3
v1.0.2
Patch Changes
- 6e143b4: Fixes a link back to the shown route being ignored while a navigation to another route is pending.
v2.0.0-next.44
Patch Changes
-
aa5e4be: A single-flight mutation answered with
revalidate: "*"now collects every query on the target page instead of none. -
b23cdc7: Under a
base, a path that starts with/is now a full path everywhere, and the router never adds the base to it. This coversnavigate(),useLinkState,useResolvedPath, and query and server-function redirects, and matches what<a href>and a raw HTTP redirect already did.redirect()comes from@solidjs/web, which doesn't know the router's base, soredirect(paths.login)used to land on/app/app/login. It now lands on/app/login.Migration: under
base: "/app",navigate("/about")now goes to/about. Usepaths.aboutor`${base}/about`. The same applies touseLinkState(() => "/about"),useResolvedPath(() => "/about")andredirect("/login"). A full path outside the base is another document:navigate()to one, like an anchor or a redirect, now loads the document instead of navigating softly. Under Vite'sbase, passimport.meta.env.BASE_URLas the routerbase. -
e29aeda: Under a
base,navigate(paths.about)anduseLinkState(paths.about)no longer add the base twice. A paths node already includes the base, so withbase: "/app"they gave/app/app/about. They now use the node's path as-is and give/app/about.useLinkState(paths.about)also works underhashHistory, where it never reported the link as current before. -
10452bd: A route
preloadthat throws no longer leaves the router in preload mode.usePreloadRoute, link preloading and route mounting now reset their preload flags even when the preload throws. Before, one throwing preload made every later query read count as a preload, so query redirects and Responses were ignored for the rest of the session. -
d034252: The router's route-root owner now comes from
createRoot(() => getOwner())instead ofcreateOwner().createOwneris leaving solid-js's public types (solid#4515, typed only throughsolid-js/internal), and this uses only public API with the same parent, hydration ids and disposal.
v1.0.1
Patch Changes
-
eaafba6: Stamp history depth from the current entry instead of
history.length, souseBeforeLeaveand scroll restoration keep working on Back once the browser's session history is full (#694) -
c3cbd67: Throw a descriptive error in development when an action is called directly instead of through
useAction. -
473c270: Anchor click handling no longer intercepts links with a non-http(s) scheme (
blob:,mailto:,tel:,data:, …). Previouslyblob:links could be wrongly routed because they inherit the page origin and bypassed the same-origin check. -
5a46ba1: Speed up
<A>server rendering by roughly 5x<A>spent most of its server render time inmergePropsandsplitProps, which build
accessor-backed prop objects that can never be observed during a one shot
renderToString. The defaultactiveClass/inactiveClassmerge is gone, the
location.pathnamenormalization is shared instead of repeated per link,JSON.stringify
is skipped when there is nostate, and on the server a link that passes nothing beyond
the props<A>consumes itself now skipssplitPropsand the JSX spread entirely.Rendered output is unchanged on the client, and unchanged on the server apart from the
linkmarker serializing aslinkrather thanlink="true"on that fast path. Client
bundles get slightly smaller, since the server branch is constant folded away. -
65f9ee7: Fixes browser history navigation when Forward is pressed while a Back transition is waiting on route data.
v2.0.0-next.43
Patch Changes
- 7872c96: A
basewith a trailing slash, such as Vite'simport.meta.env.BASE_URL("/app/"), no longer produces double slashes.Router.pathshrefs andnavigate("/about")now give/app/aboutinstead of/app//about, which matched no route. - 1865ccc: Stamp a pushed history entry's
_depthas one above the current entry instead ofhistory.length - 1. Browsers cap session history (50 entries in Chromium and Firefox), so once the cap was reached every new entry got the same depth. That broke scroll restoration anduseBeforeLeaveback-navigation deltas on long sessions. Entries the router did not push, such as a#anchorjump, are stamped one above the last known depth as well. - d4c5e6e: Peer dependencies on
solid-jsand@solidjs/webmove to^2.0.0-rc.19. - ea3d8ba: Server link claims no longer parse a root-relative href with
URLwhen its path and query only use charactersURLkeeps unchanged and it has no./..segments, andcomparablePathskips its parse for such paths. Other hrefs still go throughURL. On a 1000-link SSR page this cuts the claims' cost per request from about 1.2 ms to about 0.4 ms. - 8d2a9e4:
query.getno longer returns a value from a fetch that was superseded. When an older fetch for a key settles afterrevalidate()started a newer one, or afterquery.setwrote a value, its result is no longer written over the newer value. - 5f02d81: A server-side
navigate()now writes its 302 status andLocationheader into the existingevent.responseinstead of replacing the object. Headers already on the response, such asSet-Cookieand the flash-cookie clear, are kept, and a redirect issued aftercreateSSRResponsecaptured the head still reaches it. Query redirects during SSR resolveLocationagainst the router base as a result. - 7488be9: Link preloading and click handling resolve an anchor's
hrefagainstdocument.baseURI. An anchor cloned from a<template>keeps its rawhref(e.g./about) until it is adopted into the page, soeagerPreload's idle flush threwInvalid URLwhen it reached one that a transition still held off the page (#704).
v2.0.0-next.42
Patch Changes
- eee71c5:
liveQuery(fn, key)now declares a server functionlive()itself, soliveQuery(fn, key)gets the transport's live lifecycle (live address,Last-Event-IDresume, response-lifetime deaths,Retry-After) without wrapping by hand. An explicitlive(fn)passes through untouched. Hydration takeover forwards the served value to the first connection, so an unchanged value costs nothing on the wire. - 22c6306: Dev builds name the data layer's primitives after their keys (
query:<key>,liveQuery.status:<key>) and the router's location, url and submissions nodes (router.*), so attribution diagnostics say which query is waiting instead of"signal". The names sit behindDEV &&and fold out of production bundles.
v2.0.0-next.41
Patch Changes
- 7ec5ea1: Rename the router's
actiontoformAction(and theActiontype toFormAction): it is the form layer — submissions,aria-busy, no-JS posts,.with()— whileactionis solid-js's own primitive.actionandActionstay as deprecated aliases with a dev warning until the next major.useActionis deprecated with no replacement: call the server function (or a coreaction) directly, since the router now applies revalidation and redirects on any server function call. - 27312e1: Single flight is now the router's, not the action layer's: a mounted router subscribes to the server function transport at mount (unless
singleFlight={false}), so a server function called straight from an event handler gets itsX-Revalidatekeys, redirect and flight data applied without an action. Query reads, the flight consumer and actions now share one redirect/revalidation path, so action redirects resolve against the router base the same way query redirects do. - 3c0fe32:
query()stamps the fetch it starts, and every wrapper it hands a reader, with when that fetch started (OBSERVE.attribution.markFlight, observe and dev builds only). Page data a route's preload started, and read a render pass later behind the page's lazy chunk, no longer reads as a waterfall toASYNC_WATERFALLorSSR_BOUNDARY_WATERFALL. Takes effect with the solid release that carries the stamps on its core slot (solidjs/solid#4108); older versions ignore it.
v2.0.0-next.40
Patch Changes
-
9cf2230: Route params are decoded (#670).
useParams(),props.paramsandRouter.match()return each dynamic segment decoded after matching, so/item/%E7%8C%ABgivesid: "猫"andpaths.item("猫")round-trips.matchFilterssee the decoded value, so{ k: ["猫"] }now matches. An encoded slash stays inside its param (/a%2Fb/viewgivesname: "a/b"for/:name/view), splat params are decoded segment by segment, and a malformed escape is left raw.match.pathandlocation.pathnamekeep the URL's encoding.Breaking: code that already calls
decodeURIComponenton params decodes twice; drop the extra decode. Encode a param (or usepaths) when interpolating it into a URL by hand. -
3832cd5: Link claims trust the server's link state at hydration: an anchor the server marked is registered without resolving its URL, and is resolved on the first routing change. Anchors with an authored
aria-current, and pages rendered without server link state, are resolved at claim as before. -
5943f7f:
serverRouteComponentwith a bareGET(fn)source sends one request per link visit instead of two (#677). The router hands a preload's call to the next render with the same args, so the route mounts the result the hover or focus preload already started. The hand-off happens once, within the same 5 s windowquery()gives a preload. A later visit calls fresh, a failed preload makes the render retry, and concurrent preloads of the same args share one call.query()andliveQuery()sources are unchanged. -
828b232: Add
useInRouter, which returns whether the calling component is rendered under a router. The other router primitives throw outside one, so components that also render there (an error fallback above the router, a shared link component) can check first instead of wrappinguseLocation()in atry/catch. Like the other primitives, it throws when called with no reactive owner, such as from an event handler.