Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/route-owner-create-root.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@solidjs/router": patch
---

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.
7 changes: 5 additions & 2 deletions src/routers/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import type {Component} from "solid-js";
import type {JSX} from "@solidjs/web";
import {
createMemo,
createOwner,
createRoot,
getOwner,
onCleanup,
runWithOwner,
untrack,
Expand Down Expand Up @@ -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
Expand Down
Loading