Repository navigation
Done
Labels
vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/web
Steps to reproduce
- Publish a light theme called Wallpaper Source with a wallpaper and CSS that displays its background image on the settings page.
- Publish a light theme called Plain Draft without a wallpaper, with CSS that displays the theme background image on the settings page and falls back to a green gradient when no image is available.
- Open Settings, then Appearance.
- Select Wallpaper Source and wait for its wallpaper to appear.
- Choose Duplicate on Plain Draft.
Expected behavior
The draft shows Plain Draft's green fallback background because it has no wallpaper.
Actual behavior
The draft displays Wallpaper Source's image instead of the green background.
Impact
Minor bug or occasional failure. People previewing a different theme after selecting a published wallpaper see the wrong background whenever the draft CSS uses the theme background image.
Version or commit
main at ecb295516f. The cause is at apps/web/src/themePalette.ts:1681.
Environment
Linux x64 boat.dev default machine, a fresh checkout.
Logs or stack traces
linear-gradient(rgb(0, 255, 0), rgb(0, 255, 0))Automated repro
Fails in 2 of 2 runs on main: apply the patch with git apply, then run the command.
diff --git a/scripts/scenarios/theme-preview-clears-other-wallpaper.e2e.ts b/scripts/scenarios/theme-preview-clears-other-wallpaper.e2e.ts
new file mode 100644
index 0000000000..77950e5bef
--- /dev/null
+++ b/scripts/scenarios/theme-preview-clears-other-wallpaper.e2e.ts
@@ -0,0 +1,74 @@
+import { copyFile, mkdir } from "node:fs/promises";
+import { join } from "node:path";
+
+import { expect } from "e2e";
+
+import { T3_HOME } from "../e2e.config.ts";
+import { makeState, runPromise, test, WEB } from "./t3.ts";
+
+const css = `[data-settings-page-scroll] {
+ background-image: var(--theme-background-image, linear-gradient(#00ff00, #00ff00)) !important;
+ background-size: cover !important;
+}`;
+const theme = (name: string) =>
+ JSON.stringify({
+ name,
+ appearance: "light",
+ canvas: "#f4f1ff",
+ accent: "#6d5ae6",
+ css,
+ });
+
+// A red pixel, stretched across the settings page by the published theme's CSS.
+const wallpaper = Uint8Array.from(
+ Buffer.from(
+ "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR4nGP4z8AAAAMBAQDJ/pLvAAAAAElFTkSuQmCC",
+ "base64",
+ ),
+);
+
+test(
+ "A draft does not inherit another theme's published wallpaper",
+ WEB,
+ async ({ t3, app, screen, browser }) => {
+ const files = {
+ "wallpaper-source.json": theme("Wallpaper Source"),
+ "plain-draft.json": theme("Plain Draft"),
+ "wallpaper-source.png": wallpaper,
+ };
+ const project = await t3.project("theme-preview", files);
+ const themesDir = join(T3_HOME, "userdata", "themes");
+ await mkdir(themesDir, { recursive: true });
+ for (const name of Object.keys(files)) {
+ await copyFile(join(project, name), join(themesDir, name));
+ }
+ await runPromise(makeState(T3_HOME).cli(["theme", "set", "wallpaper-source"]));
+ await t3.open("/settings/appearance");
+
+ await screen.getByRole("button", "Use Wallpaper Source theme", { exact: false }).tap();
+ await expect
+ .poll(() =>
+ browser.evaluate(() =>
+ getComputedStyle(
+ document.querySelector("[data-settings-page-scroll]")!,
+ ).backgroundImage.includes("blob:"),
+ ),
+ )
+ .toBe(true);
+
+ await screen.getByRole("button", "Duplicate Plain Draft", { exact: true }).tap();
+ await expect
+ .poll(() => browser.evaluate(() => document.documentElement.dataset.themeId))
+ .toBe("__preview");
+ await app.screenshot("draft-background");
+ await expect
+ .poll(() =>
+ browser.evaluate(
+ () =>
+ getComputedStyle(document.querySelector("[data-settings-page-scroll]")!)
+ .backgroundImage,
+ ),
+ )
+ .toBe("linear-gradient(rgb(0, 255, 0), rgb(0, 255, 0))");
+ },
+);pnpm scenarios:prove scripts/scenarios/theme-preview-clears-other-wallpaper.e2e.ts --base mainWorkaround
No response
Metadata
Metadata
Assignees
Labels
vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.


Activity