Skip to content

Releases

v2.0.1

Choose a tag to compare

@github-actions github-actions released this 20 Nov 03:03
7347290

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-Revalidate header off the SSR document response (#737).

v2.0.0

Choose a tag to compare

@github-actions github-actions released this 17 Nov 07:08
2680f6b

Major Changes

  • 9b66caf: Remove the legacy component API. The createRouter factory (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
      createRouterComponent integration wrapper. Use
      createRouter({ routes, history }) with the browserHistory (default),
      hashHistory, or memoryHistory adapters; on the server the request URL
      drives a static integration automatically.
    • JSX <Route> (and its RouteProps type). Routes are config objects —
      the single source of truth the typed path proxy infers from.
      createFlightDataCollector likewise no longer accepts JSX trees; hand it
      config objects, an array, a thunk, or a router instance.
    • <A> and Navigate. Anchors are plain <a href> elements: the claims
      integration applies aria-current="page", data-active, and
      data-pending automatically, and useLinkState remains the escape hatch
      for custom client links. For Navigate-style declarative redirects, call
      useNavigate() in the route component or redirect from a preload.
    • The create hook on RouterIntegration (only the legacy components
      called it).

    Renamed:

    • useCurrentMatches is now useRouteMatches — same behavior, an accessor
      of the router's resolved matches for the current location, outermost
      first. The name draws the line against useMatch: one reflects the route
      tree, the other tests a path pattern you supply.
    • usePreloadRoute keeps its name and now also accepts typed path nodes
      (paths.users(2).settings) alongside strings and URLs.

    hashParser moved to src/routers/history.ts (exported for integrations);
    createMemoryHistory is replaced by the memoryHistory(initialPath) adapter,
    which carries go/back/forward/listen for tests and tools.

  • 0a1101a: Renumber the Solid 2 prerelease line from 1.0.0-next.* to 2.0.0-next.*. The 0.16 line has been declared stable as 1.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.12 is the successor to 1.0.0-next.11. If you track the next tag with a ^1.0.0-next.* range, update it to 2.0.0-next.* or a stable 1.x will 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 createRouter factory, 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 the root prop and receives the matched content as props.children. The factory's preload option replaces rootPreload.
    • Router.paths is 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 from matchFilters (new int filter types params as numbers) and search types from an optional per-route Standard Schema search validator. Every node coerces via toString, and navigate()/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 as config.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 createRouter integration 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's data prop now receives the preload result.

Minor Changes

  • dff457e: Plain <a> elements now carry link state automatically — no <A> wrapper needed. The Solid compiler claims every a[href] at creation and re-claims when a dynamic href changes; the router consumes those claims (for routers created through createRouter) and maintains:

    • aria-current="page" — the location matches the link exactly
    • data-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, and rel="external" links are left alone; with explicitLinks only anchors with the link attribute 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 href values directly (<a href={paths.users(2)}>): TypedPath carries the JSX serializable-attribute brand and SSR stringifies the node into markup.

    useLinkState's (and claimed anchors') pending now 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: false in the createRouter config. Custom history adapters own their session and are not wrapped implicitly; pass scrollRestoration: true to thread restoration through one.

  • 2abd13b: Add defineRoutes, an identity helper with a const type parameter that
    preserves route literal types for extracted route trees. Inline arrays passed
    to createRouter already infer literally; defineRoutes removes the need
    for as const on 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. Programmatic useAction calls have no form and set nothing. Style with CSS:

    form[aria-busy] button {
      pointer-events: none;
      opacity: 0.6;
    }
  • 0e06170: Add the @solidjs/router/fs emission adapter: fileRoutes(entries) converts a neutral filesystem-routing manifest into RouteDefinitions, wiring lazy() components (with moduleUrl for route assets) and spreading route config, while preserving literal types so RoutePaths keeps working for typed navigation.

  • 08d35de: Lazy route subtrees: children accepts 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 into paths and 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's default or routes export (or a direct array) is used.

  • ff75957: Add useLinkState — reactive active/current/pending state 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, end for exact-only). Accepts typed paths nodes as well as strings.

    createFlightDataCollector also accepts a createRouter instance directly: its routes, base, and preload are 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 ...

Read more

v1.0.3

Choose a tag to compare

@github-actions github-actions released this 11 Nov 00:08
3d553aa

Patch Changes

  • 821b7e1: <A> sets aria-current="page" only when the link's query also matches the current location (parameter order aside), so filter links like /?tag=a and /?tag=b are no longer all marked as the current page. The active class still matches on the path only (#518).

v1.0.2

Choose a tag to compare

@github-actions github-actions released this 10 Nov 23:15
707c63a

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

v2.0.0-next.44 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 04 Nov 06:09
3a0bb6a

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 covers navigate(), 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, so redirect(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. Use paths.about or `${base}/about`. The same applies to useLinkState(() => "/about"), useResolvedPath(() => "/about") and redirect("/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's base, pass import.meta.env.BASE_URL as the router base.

  • e29aeda: Under a base, navigate(paths.about) and useLinkState(paths.about) no longer add the base twice. A paths node already includes the base, so with base: "/app" they gave /app/app/about. They now use the node's path as-is and give /app/about. useLinkState(paths.about) also works under hashHistory, where it never reported the link as current before.

  • 10452bd: A route preload that 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 of createOwner(). createOwner is leaving solid-js's public types (solid#4515, typed only through solid-js/internal), and this uses only public API with the same parent, hydration ids and disposal.

v1.0.1

Choose a tag to compare

@github-actions github-actions released this 30 Oct 05:07
14fdf54

Patch Changes

  • eaafba6: Stamp history depth from the current entry instead of history.length, so useBeforeLeave and 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:, …). Previously blob: 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 in mergeProps and splitProps, which build
    accessor-backed prop objects that can never be observed during a one shot
    renderToString. The default activeClass / inactiveClass merge is gone, the
    location.pathname normalization is shared instead of repeated per link, JSON.stringify
    is skipped when there is no state, and on the server a link that passes nothing beyond
    the props <A> consumes itself now skips splitProps and the JSX spread entirely.

    Rendered output is unchanged on the client, and unchanged on the server apart from the
    link marker serializing as link rather than link="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

v2.0.0-next.43 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 28 Oct 05:41
36f6b49

Patch Changes

  • 7872c96: A base with a trailing slash, such as Vite's import.meta.env.BASE_URL ("/app/"), no longer produces double slashes. Router.paths hrefs and navigate("/about") now give /app/about instead of /app//about, which matched no route.
  • 1865ccc: Stamp a pushed history entry's _depth as one above the current entry instead of history.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 and useBeforeLeave back-navigation deltas on long sessions. Entries the router did not push, such as a #anchor jump, are stamped one above the last known depth as well.
  • d4c5e6e: Peer dependencies on solid-js and @solidjs/web move to ^2.0.0-rc.19.
  • ea3d8ba: Server link claims no longer parse a root-relative href with URL when its path and query only use characters URL keeps unchanged and it has no ./.. segments, and comparablePath skips its parse for such paths. Other hrefs still go through URL. 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.get no longer returns a value from a fetch that was superseded. When an older fetch for a key settles after revalidate() started a newer one, or after query.set wrote a value, its result is no longer written over the newer value.
  • 5f02d81: A server-side navigate() now writes its 302 status and Location header into the existing event.response instead of replacing the object. Headers already on the response, such as Set-Cookie and the flash-cookie clear, are kept, and a redirect issued after createSSRResponse captured the head still reaches it. Query redirects during SSR resolve Location against the router base as a result.
  • 7488be9: Link preloading and click handling resolve an anchor's href against document.baseURI. An anchor cloned from a <template> keeps its raw href (e.g. /about) until it is adopted into the page, so eagerPreload's idle flush threw Invalid URL when it reached one that a transition still held off the page (#704).

v2.0.0-next.42

v2.0.0-next.42 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 22 Oct 08:49
83380e9

Patch Changes

  • eee71c5: liveQuery(fn, key) now declares a server function live() itself, so liveQuery(fn, key) gets the transport's live lifecycle (live address, Last-Event-ID resume, response-lifetime deaths, Retry-After) without wrapping by hand. An explicit live(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 behind DEV && and fold out of production bundles.

v2.0.0-next.41

v2.0.0-next.41 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 20 Oct 17:59
24eee07

Patch Changes

  • 7ec5ea1: Rename the router's action to formAction (and the Action type to FormAction): it is the form layer — submissions, aria-busy, no-JS posts, .with() — while action is solid-js's own primitive. action and Action stay as deprecated aliases with a dev warning until the next major. useAction is deprecated with no replacement: call the server function (or a core action) 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 its X-Revalidate keys, 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 to ASYNC_WATERFALL or SSR_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

v2.0.0-next.40 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 14 Oct 20:20
42ef623

Patch Changes

  • 9cf2230: Route params are decoded (#670). useParams(), props.params and Router.match() return each dynamic segment decoded after matching, so /item/%E7%8C%AB gives id: "猫" and paths.item("猫") round-trips. matchFilters see the decoded value, so { k: ["猫"] } now matches. An encoded slash stays inside its param (/a%2Fb/view gives name: "a/b" for /:name/view), splat params are decoded segment by segment, and a malformed escape is left raw. match.path and location.pathname keep the URL's encoding.

    Breaking: code that already calls decodeURIComponent on params decodes twice; drop the extra decode. Encode a param (or use paths) 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: serverRouteComponent with a bare GET(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 window query() 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() and liveQuery() 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 wrapping useLocation() in a try/catch. Like the other primitives, it throws when called with no reactive owner, such as from an event handler.