fix(web): surface a toast when copying the install command fails - #5495
Open
pedrofrxncx wants to merge 2 commits into
Open
fix(web): surface a toast when copying the install command fails#5495pedrofrxncx wants to merge 2 commits into
pedrofrxncx wants to merge 2 commits into
Conversation
navigator.clipboard.writeText() can reject (insecure context, denied permission, or browser policy) and the promise's rejection was unhandled — the Copy button would silently do nothing with no feedback. Mirrors the existing copyText() error-toast pattern used in the sandbox file explorer.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A bug found while auditing the recently-merged "Install on Mac" account-popover entry (#5492), which reuses
DownloadAppDialog.Why:
navigator.clipboard.writeText()returns a Promise that rejects when the page isn't in an active/focused tab, runs in an insecure context, or the browser denies clipboard permission. The dialog's copy button only chained.then(onSuccess)with no rejection handler, so a failed copy left the button silently unchanged (never showing "Copied") with an unhandled-promise-rejection in the console and zero user feedback — the user is stuck assuming the paste will work when nothing was actually copied.Fix: pass a rejection handler to
.then()that shows atoast.error, mirroring the existingcopyText()error-toast pattern already used inapps/web/src/components/sandbox/preview/file-explorer/file-explorer.tsx. Added thedownloadApp.copyFailedLabelstring to bothenandpt-brdictionaries.Reviewer check:
cd apps/web && bunx tsc --noEmit(clean),bunx oxlint apps/web/src/components/download-app-dialog.tsx(0 warnings/errors). No existing test file for this component; the change is a straightforward UI wiring fix with no trust boundary, so no new test was added per repo testing policy.Locally ran:
bun run fmt,bunx tsc --noEmit(apps/web workspace),bunx oxlinton the touched files. Full CI validates the rest.Summary by cubic
Show an error toast when copying the install command fails in
DownloadAppDialog. This fixes silent clipboard failures and tells users to select the command manually.navigator.clipboard.writeText()withtoast.error(and correct@deco/ui/components/sonner.tsximport).downloadApp.copyFailedLabeltoenandpt-bri18n.Written for commit 7c6bf70. Summary will update on new commits.