Repository navigation
Closed
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
- Open the web app, signed in, on the home screen, with a project already added.
- Choose Settings.
- Choose Appearance.
- Choose Add theme.
- Point Open VSX at a stand-in that answers a search for Nightfall with one theme that is not installed, and that withholds the theme package until you let the download finish.
- Search community themes for nightfall.
- Choose Install for Nightfall.
- While that package is still downloading, use the browser Back button so Appearance closes.
- Let the stand-in finish sending the package.
- Choose Settings, then Appearance, and look at the theme library.
Expected behavior
Nightfall is not in the theme library. Leaving Appearance cancelled the download, the same way Cancel does.
Actual behavior
Nightfall is in the theme library.
Impact
Minor bug or occasional failure. Users navigating away during a slow community theme download can receive a saved theme installation from the dismissed import session.
Version or commit
main at 49c3ab8632. The cause is at apps/web/src/components/settings/ThemeImportDialog.tsx:164.
Environment
The web app in Chromium on Linux x64, a fresh checkout.
Logs or stack traces
expect leaving Appearance to cancel its pending theme installation: expectedAutomated repro
Fails in 2 of 2 runs on main: apply the patch with git apply, then run the command.
diff --git a/apps/web/src/components/settings/ThemeImportDialog.browser.test.tsx b/apps/web/src/components/settings/ThemeImportDialog.browser.test.tsx
index 0cde5b8f1f..8711446231 100644
--- a/apps/web/src/components/settings/ThemeImportDialog.browser.test.tsx
+++ b/apps/web/src/components/settings/ThemeImportDialog.browser.test.tsx
@@ -2,7 +2,7 @@ import { StrictMode } from "react";
import { describe, expect, it, vi } from "vite-plus/test";
import { page, userEvent } from "vite-plus/test/browser";
-import { render } from "../../../test/render";
+import { act, render } from "../../../test/render";
import {
CUSTOM_THEMES_STORAGE_KEY,
getCustomThemes,
@@ -12,7 +12,7 @@ import {
themeColorToHex,
THEME_FILE_VERSION,
} from "../../themePalette";
-import type { OpenVsxThemeExtension } from "../../openVsxThemes";
+import { importOpenVsxThemeExtension, type OpenVsxThemeExtension } from "../../openVsxThemes";
import { ThemeImportDialog } from "./ThemeImportDialog";
const searchOpenVsxThemes = vi.hoisted(() => vi.fn());
@@ -222,3 +222,40 @@ describe("ThemeImportDialog JSONC imports", () => {
]);
});
});
+
+it.each(["Cancel", "navigation"])(
+ "does not install a pending community theme after %s",
+ async (exit) => {
+ using _themes = isolateThemes();
+ searchOpenVsxThemes.mockReset();
+ searchOpenVsxThemes.mockResolvedValue([extension]);
+ const download = Promise.withResolvers<ReturnType<typeof parseThemeFile>[]>();
+ vi.mocked(importOpenVsxThemeExtension).mockReset();
+ vi.mocked(importOpenVsxThemeExtension).mockReturnValue(download.promise);
+ await using screen = await render(
+ <ThemeImportDialog
+ open
+ onOpenChange={() => {}}
+ onImported={() => true}
+ onImportedMany={() => {}}
+ />,
+ );
+ await userEvent.fill(page.getByLabelText("Search Open VSX themes"), "night");
+ await page.getByRole("button", { name: "Install Nightfall" }).click();
+ if (exit === "Cancel") await page.getByRole("button", { name: "Cancel", exact: true }).click();
+ await screen.unmount();
+ await act(async () => {
+ download.resolve([
+ {
+ ...parseThemeFile(theme("Nightfall")),
+ collection: { id: extension.collectionId, label: extension.name },
+ },
+ ]);
+ await download.promise;
+ });
+ expect(
+ getCustomThemes(),
+ "expect leaving Appearance to cancel its pending theme installation",
+ ).toEqual([]);
+ },
+);cd apps/web && pnpm exec vp test run src/components/settings/ThemeImportDialog.browser.test.tsxWorkaround
No response
Metadata
Metadata
Assignees
Labels
vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.


Activity