Skip to content

Commit 42de55b

Browse files
hi-ogawaclaude
andauthored
fix: clear fetch error when zip is successfully loaded via drop (#3)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 381c45f commit 42de55b

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

e2e/basic.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ test("file input", async ({ page }) => {
1414
await testHtmlReport(page);
1515
});
1616

17+
test("fetch error clears on drop recovery", async ({ page }) => {
18+
await page.goto("/?url=http://localhost:1/test.zip");
19+
await expect(page.getByTestId("fetch-error")).toContainText("likely blocked by CORS");
20+
await page.locator('input[type="file"]').setInputFiles("docs/assets/vitest-html-reporter.zip");
21+
await expect(page.getByTestId("fetch-error")).not.toBeVisible();
22+
await testHtmlReport(page);
23+
});
24+
1725
async function testHtmlReport(page: Page) {
1826
await expect(page.getByTestId("status")).toContainText("Cached 7 files");
1927
const frame = page.frameLocator("iframe");

src/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,10 @@
209209
function FetchError({ error }) {
210210
return h(
211211
"div",
212-
{ style: { textAlign: "center", fontSize: "0.85rem", color: "#c00", marginTop: "1rem" } },
212+
{
213+
"data-testid": "fetch-error",
214+
style: { textAlign: "center", fontSize: "0.85rem", color: "#c00", marginTop: "1rem" },
215+
},
213216
h("div", null, error.message),
214217
h(
215218
"div",
@@ -238,6 +241,7 @@
238241
}
239242
setFileCount(count);
240243
setStatusMsg(`Cached ${count} files. Loading...`);
244+
setFetchError(null);
241245
setLoaded(true);
242246
}
243247

0 commit comments

Comments
 (0)