Skip to content

fix(web): surface a toast when copying the install command fails - #5495

Open
pedrofrxncx wants to merge 2 commits into
mainfrom
fix/download-app-clipboard-error-w4
Open

fix(web): surface a toast when copying the install command fails#5495
pedrofrxncx wants to merge 2 commits into
mainfrom
fix/download-app-clipboard-error-w4

Conversation

@pedrofrxncx

@pedrofrxncx pedrofrxncx commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

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 a toast.error, mirroring the existing copyText() error-toast pattern already used in apps/web/src/components/sandbox/preview/file-explorer/file-explorer.tsx. Added the downloadApp.copyFailedLabel string to both en and pt-br dictionaries.

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 oxlint on 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.

  • Bug Fixes
    • Handle rejected navigator.clipboard.writeText() with toast.error (and correct @deco/ui/components/sonner.tsx import).
    • Add downloadApp.copyFailedLabel to en and pt-br i18n.

Written for commit 7c6bf70. Summary will update on new commits.

Review in cubic

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant