mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: detect CSS preload errors and keep banner visible during error states
- Add "unable to preload" pattern to isChunkError for Vite CSS preload failures - Move ConnectionMonitor and ConnectionBanner outside ErrorBoundary so they remain visible when the error boundary catches a render crash - Add test for CSS preload error retry
This commit is contained in:
@@ -33,6 +33,19 @@ describe("retryDynamicImport", () => {
|
||||
expect(importFn).toHaveBeenCalledTimes(3);
|
||||
});
|
||||
|
||||
it("retries CSS preload errors", async () => {
|
||||
const mod = { default: () => null };
|
||||
const importFn = vi
|
||||
.fn()
|
||||
.mockRejectedValueOnce(
|
||||
new TypeError("Unable to preload CSS for /assets/tool-page-DDbXBANV.css"),
|
||||
)
|
||||
.mockResolvedValue(mod);
|
||||
const result = await retryDynamicImport(importFn, 3, 0);
|
||||
expect(result).toBe(mod);
|
||||
expect(importFn).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
it("only retries chunk-related errors, not other errors", async () => {
|
||||
const err = new Error("Some other error");
|
||||
const importFn = vi.fn().mockRejectedValue(err);
|
||||
|
||||
Reference in New Issue
Block a user