fix(chat): only show copied checkmark after clipboard write succeeds - #5136
Merged
Conversation
The install-snippet copy button in ConnectDesktopDialog set the copied/checkmark state synchronously right after calling navigator.clipboard.writeText, without waiting for the write to resolve. If the write rejects (e.g. document not focused, clipboard permission denied), the UI still claims success and the promise rejection goes unhandled. Every other clipboard-copy call site in apps/mesh/src/web (account-popover.tsx, markdown.tsx, preview.tsx, etc.) awaits or chains .then() before updating UI state — this one didn't.
pedrofrxncx
enabled auto-merge (squash)
July 23, 2026 20:39
decocms Bot
pushed a commit
that referenced
this pull request
Jul 23, 2026
PR: #5136 fix(chat): only show copied checkmark after clipboard write succeeds Bump type: patch - decocms (apps/mesh/package.json): 4.113.1 -> 4.113.2 Deploy-Scope: web
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.
Source: bug found while auditing desktop-linking UI (
apps/mesh/src/web/components/chat/connect-desktop-dialog.tsx) for the desktop-launcher-resilience focus area. Note: the area hint pointed atapps/mesh/src/web/desktop/(the Tauri launcher), but that directory doesn't exist onmainyet — it's only introduced by the still-open PR #4178 — so I audited the existing desktop-linking surface that does live on main instead.The bug: the install-snippet copy button called
navigator.clipboard.writeText(...)and then immediately, synchronously, setcopied = true(showing a checkmark) without waiting for the write to resolve. If the write rejects — document not focused, clipboard permission denied, etc. — the UI still claims success and the rejected promise is left unhandled (console warning). Every other clipboard-copy call site inapps/mesh/src/web(account-popover.tsx,markdown.tsx,preview.tsx,webhook-secret-dialog.tsx, ...) awaits or chains.then()/.catch()before touching UI state — this one didn't.Fix: chain the state update inside
.then()so the checkmark only appears once the write actually succeeds, matching the pattern used everywhere else in the codebase (e.g.account-popover.tsx).Failure scenario: user clicks copy while the tab/window isn't focused (a plausible state right after switching to read the
bunx decocms@latest linksnippet) →writeTextrejects → checkmark still shows, clipboard is actually empty, and the user pastes nothing into their terminal.To confirm:
cd apps/mesh && bunx tsc --noEmit(green); read the diff — it's a 1-line control-flow change with no type/behavior surface beyond the click handler.Verified locally:
bun run fmt(clean) andbunx tsc --noEmitinapps/mesh(no new errors introduced by this change — a pre-existing unrelated error in an untrackedbackfill-assets.test.tsfile in this worktree is unaffected). Full CI validates the rest.Summary by cubic
Fix copy button feedback in ConnectDesktopDialog: show the checkmark only after navigator.clipboard.writeText succeeds. Prevents false success when clipboard write fails (e.g., tab not focused or permission denied) and avoids unhandled promise rejections.
Written for commit 801a700. Summary will update on new commits.