From 801a7002f15531350a28dcdf4ab459f36e1f3823 Mon Sep 17 00:00:00 2001 From: pedrofrxncx Date: Thu, 23 Jul 2026 17:37:04 -0300 Subject: [PATCH] fix(chat): only show copied checkmark after clipboard write succeeds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../src/web/components/chat/connect-desktop-dialog.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/mesh/src/web/components/chat/connect-desktop-dialog.tsx b/apps/mesh/src/web/components/chat/connect-desktop-dialog.tsx index 4d03ec22fd..02b846bb9c 100644 --- a/apps/mesh/src/web/components/chat/connect-desktop-dialog.tsx +++ b/apps/mesh/src/web/components/chat/connect-desktop-dialog.tsx @@ -96,9 +96,10 @@ export function ConnectDesktopDialog({ variant="ghost" size="icon-sm" onClick={() => { - navigator.clipboard.writeText(INSTALL_SNIPPET); - setCopied(true); - setTimeout(() => setCopied(false), 1500); + navigator.clipboard.writeText(INSTALL_SNIPPET).then(() => { + setCopied(true); + setTimeout(() => setCopied(false), 1500); + }); }} > {copied ? : }