Repository navigation
fix(preview): failed tabs no longer sit as a blank floating panel #7236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
c698494
fix(preview): show failed floating previews instead of a blank panel
gb1095 d2f6102
fix(preview): keep failed preview_status on the requested URL
gb1095 00cb03e
test(desktop): type failed-navigation automation status listeners
gb1095 5347a69
fix(preview): let Retry and Close receive clicks on the failed mini-p…
gb1095 492edd2
fix(preview): do not let a stale LoadFailed snapshot hide a live guest
gb1095 2276e1b
fix(preview): keep PiP close available on a failed mini-player
gb1095 55c38dd
fix(preview): keep failed tabs automatable and clip the overlay host
gb1095 4c8af2f
style(preview): format the failed mini-player overlay
gb1095 a4a498a
fix(preview): stub mute APIs on the failed-nav webContents mock
gb1095 8a8d52b
fix(preview): settle failed navigations instead of waiting until timeout
gb1095 1bda225
fix(preview): do not treat a detached guest as a finished load
gb1095 ab03582
fix(preview): keep retrying guests live and reject destroyed ones
gb1095 ebb3b9e
fix(preview): report retry loading during failed navigations
gb1095 808742f
fix(preview): reject destroyed guests before automation
gb1095 cb1782b
fix(preview): handle failed mini-player retries
gb1095 7c268a7
fix(preview): keep failed PiP controls reachable
gb1095 9ef66d5
fix(preview): preserve failed preview recovery state
gb1095 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
apps/web/src/components/preview/PreviewMiniPlayerUnreachable.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import { renderToStaticMarkup } from "react-dom/server"; | ||
| import { describe, expect, it } from "vite-plus/test"; | ||
|
|
||
| import { PreviewMiniPlayerUnreachable } from "./PreviewMiniPlayerUnreachable"; | ||
|
|
||
| describe("PreviewMiniPlayerUnreachable", () => { | ||
| it("shows the failed host with Retry and Close", () => { | ||
| const html = renderToStaticMarkup( | ||
| <PreviewMiniPlayerUnreachable | ||
| url="http://localhost:5173/app" | ||
| description="ERR_CONNECTION_REFUSED" | ||
| onRetry={() => undefined} | ||
| onClose={() => undefined} | ||
| />, | ||
| ); | ||
| expect(html).toContain("localhost:5173"); | ||
| expect(html).toContain("Retry"); | ||
| expect(html).toContain("Close"); | ||
| expect(html).toContain("Connection refused"); | ||
| expect(html).toContain("pointer-events-auto"); | ||
| expect(html).toContain("truncate"); | ||
| }); | ||
|
|
||
| it("falls back to the raw URL when there is no host", () => { | ||
| const html = renderToStaticMarkup( | ||
| <PreviewMiniPlayerUnreachable | ||
| url="file:///missing.html" | ||
| description="ERR_FILE_NOT_FOUND" | ||
| onRetry={() => undefined} | ||
| onClose={() => undefined} | ||
| />, | ||
| ); | ||
| expect(html).toContain("file:///missing.html"); | ||
| }); | ||
| }); |
43 changes: 43 additions & 0 deletions
43
apps/web/src/components/preview/PreviewMiniPlayerUnreachable.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import { Button } from "~/components/ui/button"; | ||
|
|
||
| import { describePreviewError } from "./errorCodeMessages"; | ||
|
|
||
| interface Props { | ||
| readonly url: string; | ||
| readonly description: string; | ||
| readonly onRetry: () => void; | ||
| readonly onClose: () => void; | ||
| } | ||
|
|
||
| /** Compact failed-navigation overlay for the floating mini-player. */ | ||
| export function PreviewMiniPlayerUnreachable({ url, description, onRetry, onClose }: Props) { | ||
| const host = safeHost(url) ?? url; | ||
| const friendly = describePreviewError(description); | ||
|
|
||
| return ( | ||
| <div className="pointer-events-auto absolute inset-0 z-[49] flex min-w-0 flex-col items-center justify-center gap-3 overflow-hidden rounded-xl bg-background px-4 text-center"> | ||
| <p className="min-w-0 max-w-full truncate text-xs font-medium text-foreground"> | ||
| Can't reach {host} | ||
| </p> | ||
| <p className="min-w-0 max-w-full text-[11px] leading-snug text-muted-foreground"> | ||
| {friendly} | ||
| </p> | ||
| <div className="flex items-center gap-2"> | ||
| <Button type="button" size="sm" onClick={onRetry}> | ||
| Retry | ||
| </Button> | ||
| <Button type="button" size="sm" variant="outline" onClick={onClose}> | ||
| Close | ||
| </Button> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| function safeHost(url: string): string | null { | ||
| try { | ||
| return new URL(url).host || null; | ||
| } catch { | ||
| return null; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.