@devries-cameron20 / t3code-1 / commits / 80ae9b5301
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): show theme conflicts even when another import fails (#23223)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: maria-rcks <maria@kuuro.net>

Victor Vogel committed Oct 29, 2026 at 12:54 UTC 80ae9b53015bc3df7f1b5d1c2bc13602ee88625b
2 files changed +63 -6
apps/web/src/components/settings/ThemeImportDialog.browser.test.tsx
+58
@@ -3,6 +3,14 @@ import { describe, expect, it, vi } from "vite-plus/test";
3 import { page, userEvent } from "vite-plus/test/browser";
4
5 import { render } from "../../../test/render";
6 +import {
7 + CUSTOM_THEMES_STORAGE_KEY,
8 + getCustomThemes,
9 + installCustomTheme,
10 + invalidateCustomThemes,
11 + parseThemeFile,
12 + THEME_FILE_VERSION,
13 +} from "../../themePalette";
14 import type { OpenVsxThemeExtension } from "../../openVsxThemes";
15 import { ThemeImportDialog } from "./ThemeImportDialog";
16
@@ -54,3 +62,53 @@ describe("ThemeImportDialog", () => {
62 );
63 });
64 });
65 +
66 +const theme = (name: string, accent = "#3b82f6") => ({
67 + version: THEME_FILE_VERSION,
68 + name,
69 + appearance: "dark",
70 + colors: { accent },
71 +});
72 +
73 +const themeFile = (name: string, accent?: string) =>
74 + new File([JSON.stringify(theme(name, accent))], `${name}.json`, { type: "application/json" });
75 +
76 +it.each(["Update existing", "Keep both"])(
77 + "keeps batch failures visible after %s",
78 + async (choice) => {
79 + using _themes = {
80 + [Symbol.dispose]() {
81 + window.localStorage.removeItem(CUSTOM_THEMES_STORAGE_KEY);
82 + invalidateCustomThemes();
83 + },
84 + };
85 + installCustomTheme(parseThemeFile(theme("Dusk")));
86 + const onOpenChange = vi.fn();
87 + await using _screen = await render(
88 + <ThemeImportDialog
89 + open
90 + onOpenChange={onOpenChange}
91 + onImported={() => true}
92 + onImportedMany={() => {}}
93 + />,
94 + );
95 + const input = document.querySelector<HTMLInputElement>('input[type="file"]')!;
96 + await userEvent.upload(input, [
97 + themeFile("Dawn"),
98 + themeFile("Dusk", "#f97316"),
99 + new File(["{"], "broken.json", { type: "application/json" }),
100 + ]);
101 +
102 + await expect.element(page.getByText("Already installed")).toBeVisible();
103 + await expect.element(page.getByText(/^broken\.json:/)).toBeVisible();
104 + expect(getCustomThemes().map((theme) => theme.label)).toContain("Dawn");
105 + await page.getByRole("button", { name: choice }).click();
106 + invalidateCustomThemes();
107 + const label = choice === "Update existing" ? "Dusk" : "Dusk (1)";
108 + expect(getCustomThemes().find((theme) => theme.label === label)?.colors).toEqual(
109 + parseThemeFile(theme("Dusk", "#f97316")).colors,
110 + );
111 + await expect.element(page.getByText(/^broken\.json:/)).toBeVisible();
112 + expect(onOpenChange).not.toHaveBeenCalledWith(false);
113 + },
114 +);
apps/web/src/components/settings/ThemeImportDialog.tsx
+5 -6
@@ -284,11 +284,10 @@ function ThemeImportBody({
284 }
285 }
286 if (installed.length > 0) onImportedMany(installed, { updated: false });
287 - if (failures.length > 0) {
288 - setError(failures.join("; "));
289 - } else if (conflicting.length > 0) {
287 + setError(failures.length > 0 ? failures.join("; ") : null);
288 + if (conflicting.length > 0) {
289 setConflicts(conflicting);
291 - } else if (installed.length > 0) {
290 + } else if (installed.length > 0 && failures.length === 0) {
291 onClose();
292 }
293 };
@@ -387,8 +386,8 @@ function ThemeImportBody({
386 }
387 if (resolved.length > 0) onImportedMany(resolved, { updated: mode === "update" });
388 setConflicts(null);
390 - if (failures.length > 0) setError(failures.join("; "));
391 - else onClose();
389 + if (failures.length > 0) setError([error, ...failures].filter(Boolean).join("; "));
390 + else if (!error) onClose();
391 };
392
393 const handleSubmit = () => {