commit c68e361f3d6c1654833fdf93a8f98a4628dea3f3
parent 78ed7a718bf059848897688f3bf1c872cc9c05ca
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 25 Sep 2026 22:54:55 -0400
export, homepage: the no-flash specs wait on the ready marker without racing the new document (brand S2)
reloadOnCommit waited on `document.documentElement.dataset.themeReady` right
after a `commit` reload. On one post-merge run (theme.spec.ts:96) the new
document had no root yet, so the predicate threw instead of returning false,
and waitForFunction rejected. `document.documentElement?.…` keeps polling
until the pre-paint script has set the marker. The fix is in all three specs
that wait this way. Re-run: theme + theme-accent + site-branding
--repeat-each 3, 39 passed.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/export/e2e/theme-accent.spec.ts b/export/e2e/theme-accent.spec.ts
@@ -94,7 +94,7 @@ test("pick Violet: it persists before paint, and --brand is violet on each base"
// The reload applies the pick on the first commit, before React hydrates —
// and hydration does not put the site's own accent back.
await page.reload({ waitUntil: "commit" });
- await page.waitForFunction(() => document.documentElement.dataset.themeReady === "1");
+ await page.waitForFunction(() => document.documentElement?.dataset.themeReady === "1");
expect((await state(page)).accent).toBe("violet");
await page.waitForLoadState("load");
await expect.poll(() => state(page)).toMatchObject({ accent: "violet", brand: ACCENTS.violet.onLight });
diff --git a/export/e2e/theme.spec.ts b/export/e2e/theme.spec.ts
@@ -34,7 +34,7 @@ async function toggleTo(page: Page, toggle: Locator, want: string | null) {
async function reloadOnCommit(page: Page) {
await page.reload({ waitUntil: "commit" });
await page.waitForFunction(
- () => document.documentElement.dataset.themeReady === "1",
+ () => document.documentElement?.dataset.themeReady === "1",
);
}
diff --git a/homepage/e2e/theme.spec.ts b/homepage/e2e/theme.spec.ts
@@ -58,7 +58,7 @@ test("dark + Signal by default; the base toggle persists with no FOUC", async ({
// the very first commit, before React hydrates.
await page.reload({ waitUntil: "commit" });
await page.waitForFunction(
- () => document.documentElement.dataset.themeReady === "1",
+ () => document.documentElement?.dataset.themeReady === "1",
);
s = await htmlState(page);
expect(s.stored).toBe("light");