Skip to content

refactor: create the route-root owner with createRoot, not createOwner - #711

Merged
ryansolid merged 2 commits into
nextfrom
claude/project-thread-x1ore2-router-owner
Oct 31, 2026
Merged

ryansolid merged 2 commits into
nextfrom
claude/project-thread-x1ore2-router-owner

Conversation

@ryansolid

@ryansolid ryansolid commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Before: the router creates its route-root owner with createOwner() from solid-js. solidjs/solid#4515 takes createOwner out of solid-js's public types (it becomes typed only through solid-js/internal; 1.x had no createOwner), so this import stops type-checking once the router builds against a solid-js with that change.

After: the router gets the same owner from createRoot(() => getOwner()!). It has the same parent and the same hydration id counter, and it is disposed with the component. It uses only public API.

How: I measured on solid's size scenarios, over solid#4515, building the router's next with and without this change:

Scenario Brotli Minified
page: base + router −39 +7
page: live + router −23 +7

The brotli drop is mostly layout. The real cost is the 7 B minified for createRoot plus the getOwner call. Router tests pass: 728 client tests, 105 server tests, and test:types. It works on a solid-js with or without #4515, so it can merge before or after.

🤖 Generated with Claude Code

https://claude.ai/code/session_015hPxMkC3jg3Uivh65gvaf2

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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015hPxMkC3jg3Uivh65gvaf2
@changeset-bot

changeset-bot Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 774617a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solidjs/router Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ryansolid ryansolid changed the title perf: create the route-root owner with createRoot, not createOwner refactor: create the route-root owner with createRoot, not createOwner Oct 30, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015hPxMkC3jg3Uivh65gvaf2
@ryansolid
ryansolid merged commit d034252 into next Oct 31, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants