From a9997aa93c21aebaae5ee51e492b99b1005d7b5b Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 30 Oct 2026 22:45:09 +0000 Subject: [PATCH 1/2] perf: create the route-root owner with createRoot, not createOwner Since solid#4444 the public `createOwner` binds `dispose` on every owner it returns. The router's route-root owner is only ever disposed with its component, so `createRoot(() => getOwner())` gives the same owner (same parent, same hydration id counter) without pulling the bind into router pages. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_015hPxMkC3jg3Uivh65gvaf2 --- .changeset/route-owner-create-root.md | 5 +++++ src/routers/components.tsx | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 .changeset/route-owner-create-root.md diff --git a/.changeset/route-owner-create-root.md b/.changeset/route-owner-create-root.md new file mode 100644 index 00000000..e6fc098d --- /dev/null +++ b/.changeset/route-owner-create-root.md @@ -0,0 +1,5 @@ +--- +"@solidjs/router": patch +--- + +The router's route-root owner now comes from `createRoot(() => getOwner())` rather than `createOwner()`. Since solid#4444, the public `createOwner` binds `dispose` on each owner it returns, and the router never calls that `dispose`, so router pages no longer ship the bind (−50 to −62 B minified on the solid repo's router size scenarios). diff --git a/src/routers/components.tsx b/src/routers/components.tsx index e36451d3..0c8d2f61 100644 --- a/src/routers/components.tsx +++ b/src/routers/components.tsx @@ -4,8 +4,8 @@ import type {Component} from "solid-js"; import type {JSX} from "@solidjs/web"; import { createMemo, - createOwner, createRoot, + getOwner, onCleanup, runWithOwner, untrack, @@ -100,7 +100,10 @@ export function Routes(props: { routerState: RouterContext; branches: () => Bran // dedicated one, created before the memo: the roots draw hydration ids from // its counter, so the ids don't depend on whether the memo first parked on // a lazy subtree (the server's render can park where the client's doesn't). - const owner = createOwner(); + // `createRoot` hands back the same kind of owner `createOwner` would, minus + // the bound `dispose` the public `createOwner` pays for (solid#4444): this + // owner is only ever disposed with the component. + const owner = createRoot(() => getOwner()!); const routeStates = createMemo((prev: RouteContext[] | undefined) => { // While a lazy subtree resolves, `matches()` is not ready and this From 774617a11edfa72c897cf565a15517d90406f113 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 30 Oct 2026 23:05:55 +0000 Subject: [PATCH 2/2] chore: reword the changeset for solid#4515 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_015hPxMkC3jg3Uivh65gvaf2 --- .changeset/route-owner-create-root.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/route-owner-create-root.md b/.changeset/route-owner-create-root.md index e6fc098d..37259e7d 100644 --- a/.changeset/route-owner-create-root.md +++ b/.changeset/route-owner-create-root.md @@ -2,4 +2,4 @@ "@solidjs/router": patch --- -The router's route-root owner now comes from `createRoot(() => getOwner())` rather than `createOwner()`. Since solid#4444, the public `createOwner` binds `dispose` on each owner it returns, and the router never calls that `dispose`, so router pages no longer ship the bind (−50 to −62 B minified on the solid repo's router size scenarios). +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.