Repository navigation
feat(web): "could not load" screen tells users how to debug it #25317
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
Merged
+252
−21
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
5034eda
feat(web): boot error screen recommends a triage command
t3dotgg f53e6fa
fix(web): clearer hierarchy and spacing on the boot error screen
t3dotgg 359b57a
fix(web): recommend t3 triage only when the desktop launcher exists
t3dotgg df12a30
fix(web): boot error screen leads with Reload, triage sits below
t3dotgg 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
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,54 @@ | ||
| import type { DesktopBridge, DesktopCliCommandState } from "@t3tools/contracts"; | ||
| import { describe, expect, it, vi } from "vite-plus/test"; | ||
|
|
||
| import { resolveTriageCommand } from "./bootError"; | ||
|
|
||
| const desktopWith = (getState: () => Promise<DesktopCliCommandState>) => | ||
| ({ cliCommand: { getState } }) as unknown as DesktopBridge; | ||
|
|
||
| const notOnPath = (launcherPath: string | null): DesktopCliCommandState => ({ | ||
| supported: launcherPath !== null, | ||
| installedPath: null, | ||
| onPath: false, | ||
| launcherPath, | ||
| }); | ||
|
|
||
| describe("resolveTriageCommand", () => { | ||
| it("prefers t3 on PATH, then the desktop launcher", async () => { | ||
| const onPath = { ...notOnPath("/home/me/.t3/bin/t3"), onPath: true }; | ||
| await expect(resolveTriageCommand(desktopWith(async () => onPath))).resolves.toBe("t3 triage"); | ||
| await expect( | ||
| resolveTriageCommand(desktopWith(async () => notOnPath("/home/me/.t3/bin/t3"))), | ||
| ).resolves.toBe("/home/me/.t3/bin/t3 triage"); | ||
| }); | ||
|
|
||
| it("quotes launcher paths for the shell that runs them", async () => { | ||
| await expect( | ||
| resolveTriageCommand(desktopWith(async () => notOnPath("/Users/O'Neil/.t3/bin/t3"))), | ||
| ).resolves.toBe(`'/Users/O'"'"'Neil/.t3/bin/t3' triage`); | ||
| await expect( | ||
| resolveTriageCommand(desktopWith(async () => notOnPath("C:\\Users\\Me\\.t3\\bin\\t3.cmd"))), | ||
| ).resolves.toBe("C:\\Users\\Me\\.t3\\bin\\t3.cmd triage"); | ||
| await expect( | ||
| resolveTriageCommand( | ||
| desktopWith(async () => notOnPath("C:\\Users\\Jo O'Neil\\.t3\\bin\\t3.cmd")), | ||
| ), | ||
| ).resolves.toBe("& 'C:\\Users\\Jo O''Neil\\.t3\\bin\\t3.cmd' triage"); | ||
| }); | ||
|
|
||
| it("falls back to npx without a usable desktop launcher", async () => { | ||
| using _warn = vi.spyOn(console, "warn").mockImplementation(() => {}); | ||
| await expect(resolveTriageCommand(undefined)).resolves.toBe("npx t3 triage"); | ||
| await expect(resolveTriageCommand({} as DesktopBridge)).resolves.toBe("npx t3 triage"); | ||
| await expect(resolveTriageCommand(desktopWith(async () => notOnPath(null)))).resolves.toBe( | ||
| "npx t3 triage", | ||
| ); | ||
| const staleWindowsPathEntry = { ...notOnPath(null), supported: true, onPath: true }; | ||
| await expect( | ||
| resolveTriageCommand(desktopWith(async () => staleWindowsPathEntry)), | ||
| ).resolves.toBe("npx t3 triage"); | ||
| await expect( | ||
| resolveTriageCommand(desktopWith(() => Promise.reject(new Error("ipc closed")))), | ||
| ).resolves.toBe("npx t3 triage"); | ||
| }); | ||
| }); |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not change the displayed command after a user copies it.
If a user copies the initial
npx t3 triagecommand beforegetState()resolves, this callback can replace the displayed text with the desktop launcher command. The button can then say “Copied” while the clipboard contains a different command. Disable copying until resolution completes, including the fallback case, so the displayed and copied commands agree.