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/require-solid-rc-15.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@solidjs/router": patch
---

Require solid-js / @solidjs/web 2.0.0-rc.15. Link and form claims follow rc.15's claim contract: an element's compiled mount claim fires once, after its initial attributes are applied, and later claims come from compiler-owned `href`/`action` writes or from `claimElementTree` sweeps (frame streams, morphs). The router's claim handlers are unchanged.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,22 @@
"@rollup/plugin-node-resolve": "15.3.0",
"@rollup/plugin-terser": "0.4.4",
"@solidjs/vite-plugin": "3.0.0-next.47",
"@solidjs/web": "^2.0.0-rc.14",
"@solidjs/web": "^2.0.0-rc.15",
"@types/jest": "^29.5.14",
"@types/node": "^22.10.0",
"babel-preset-solid": "^2.0.0-rc.2",
"jsdom": "^25.0.1",
"prettier": "^3.4.1",
"rollup": "^4.27.4",
"solid-js": "^2.0.0-rc.14",
"solid-js": "^2.0.0-rc.15",
"typescript": "^5.7.2",
"vite": "^8.2.2",
"vitest": "^4.1.11"
},
"peerDependencies": {
"@solidjs/web": "^2.0.0-rc.14",
"@solidjs/web": "^2.0.0-rc.15",
"filesystem-routing": ">=0.4.0",
"solid-js": "^2.0.0-rc.14"
"solid-js": "^2.0.0-rc.15"
},
"peerDependenciesMeta": {
"filesystem-routing": {
Expand Down
46 changes: 23 additions & 23 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions test/action-commit-release.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
import { action, createMemo, createRoot, createSignal, For, Loading, Show } from "solid-js";
import { vi } from "vitest";
import { claimElement, redirect, render } from "@solidjs/web";
import { claimElementTree, redirect, render } from "@solidjs/web";
import {
action as routerAction,
createRouter,
Expand Down Expand Up @@ -199,14 +199,14 @@ describe("#649 router actions release at the transition's commit", () => {
// a server-component morph resets attributes to the server HTML (which
// never carries aria-busy), then re-claims the element
t.form().removeAttribute("aria-busy");
claimElement(t.form());
claimElementTree(t.form());
expect(t.busy()).toBe("true");

t.mutation().resolve("ok");
await until(() => t.log.length > 0);
expect(t.busy()).toBeNull();

claimElement(t.form());
claimElementTree(t.form());
expect(t.busy()).toBeNull();
t.dispose();
});
Expand Down Expand Up @@ -315,7 +315,7 @@ describe("#649 router actions release at the transition's commit", () => {
t.form().requestSubmit();
await t.mutationStarted();
expect(t.busy()).toBe("false");
claimElement(t.form());
claimElementTree(t.form());
expect(t.busy()).toBe("false");

t.mutation().resolve("ok");
Expand Down Expand Up @@ -419,7 +419,7 @@ describe("#649 router actions release at the transition's commit", () => {
expect(t.busy()).toBe("true");

t.form().setAttribute("aria-busy", "false");
claimElement(t.form());
claimElementTree(t.form());
expect(t.busy()).toBe("false");

t.mutation().resolve("ok");
Expand Down
8 changes: 4 additions & 4 deletions test/claims.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* wrapper component. These specs compile real JSX, so they exercise the full
* chain — compiler claim emission → runtime claim hook → router consumer.
*/
import { claimElement, render } from "@solidjs/web";
import { claimElementTree, render } from "@solidjs/web";
import {
createRoot,
createSignal,
Expand Down Expand Up @@ -351,7 +351,7 @@ describe("compiler-claimed anchors", () => {

about.removeAttribute("aria-current");
about.removeAttribute("data-active");
claimElement(about);
claimElementTree(about);

expect(about.getAttribute("aria-current")).toBe("page");
expect(about.hasAttribute("data-active")).toBe(true);
Expand Down Expand Up @@ -725,7 +725,7 @@ describe("compiler-claimed anchors", () => {
// state stripped) and re-claims
step.setAttribute("aria-current", "step");
step.removeAttribute("data-active");
claimElement(step);
claimElementTree(step);
expect(step.getAttribute("aria-current")).toBe("step");
expect(step.hasAttribute("data-active")).toBe(true);

Expand Down Expand Up @@ -807,7 +807,7 @@ describe("compiler-claimed anchors", () => {
const morph = (a: Element) => {
a.removeAttribute("aria-current");
a.removeAttribute("data-active");
claimElement(a);
claimElementTree(a);
};
try {
const about = div.querySelector('[data-testid="about"]')!;
Expand Down
10 changes: 5 additions & 5 deletions test/data/events.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { claimElement } from "@solidjs/web";
import { claimElement, setAttribute } from "@solidjs/web";
import { createRoot, createSignal } from "solid-js";
import { vi } from "vitest";
import { setRouterFormHandler, setupNativeEvents } from "../../src/data/events.js";
Expand Down Expand Up @@ -959,10 +959,10 @@ describe("tap and ambient preload strategies", () => {
const a = link({ href: "/a", preload: "viewport" });
observer().intersect(a);
vi.runAllTimers();
a.setAttribute("href", "/b");
// the re-claim runs under the effect writing `href`, which outlives
// neither the anchor nor its arming
createRoot(d => (claimElement(a), d))();
// a compiler-owned `href` write re-claims the claimed anchor; it runs
// under the effect writing `href`, which outlives neither the anchor
// nor its arming
createRoot(d => (setAttribute(a, "href", "/b"), d))();
observer().intersect(a);
vi.runAllTimers();
expect(preloaded()).toEqual(["/a:false", "/b:false"]);
Expand Down
2 changes: 1 addition & 1 deletion test/hash-history.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe("hashHistory navigation (#582)", () => {
// header carries (display today, logical once @solidjs/web unwraps the
// brand) must route — this is the client leg of an action redirect
expect(isHref(paths.page1)).toBe(true);
const res = redirect(paths.page1);
const res = redirect<Response>(paths.page1);
const target = res.headers.get("Location")!;
nav(target, { scroll: false });
await settle();
Expand Down
4 changes: 2 additions & 2 deletions test/navigation-pending.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,10 @@ describe("navigation pending state (characterization, #655)", () => {
"| navigate /slow/2: call routing=true target=/slow/1 intent=navigate at=/",
"fetch:2:navigate",
"routing:true@/slow/2",
"link:/slow/1:false",
"link:/slow/2:true",
"attr:/slow/1:-",
"attr:/slow/2:+",
"link:/slow/1:false",
"link:/slow/2:true",
"| navigate /slow/2: flush routing=true target=/slow/2 intent=navigate at=/",
"| navigate /slow/2: settled routing=true target=/slow/2 intent=navigate at=/",
"| resolved 1 routing=true target=/slow/2 intent=navigate at=/",
Expand Down
5 changes: 3 additions & 2 deletions test/server/query-response-cookies.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ describe.each(["returned", "thrown"] as const)("%s query response cookies", outc
"%s appends cookies once across concurrent and cached reads",
async kind => {
const value = { message: "query result" };
const result = kind === "respond" ? respond(value) : new Response("query body");
const response = result instanceof Response ? result : result.response!;
// respond() is typed as its value; at runtime it is a Response envelope
const result = (kind === "respond" ? respond(value) : new Response("query body")) as Response;
const response = result;
response.headers.set("Cache-Control", "private, no-store");
response.headers.set("X-Query", "metadata");
const cookies = [
Expand Down
7 changes: 5 additions & 2 deletions test/server/query-response-headers.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ describe.each(["returned", "thrown"] as const)(
"%s preserves document headers, cookies and query metadata",
async kind => {
const value = { message: "query result" };
const result = kind === "respond" ? respond(value) : new Response("query body");
const response = result instanceof Response ? result : result.response!;
// respond() is typed as its value; at runtime it is a Response envelope
const result = (
kind === "respond" ? respond(value) : new Response("query body")
) as Response;
const response = result;
response.headers.set("Content-Type", "application/json");
response.headers.set("Content-Length", "42");
response.headers.set("Content-Encoding", "br");
Expand Down
Loading