🐛 Show MCP URL copied toast only after a successful copy (#13360)

The copy button for the MCP server URL in Settings > Integrations showed
the "copied" toast without waiting for the clipboard write, and left the
rejected promise unhandled when the write failed. Error reports show this
on SaaS over HTTPS too, with NotAllowedError (write permission denied).

Wait for the write, show the success toast and track the event only when
it resolves, and show an error toast when it rejects, as the token copy
button in the same file already does.

AI-assisted-by: claude-opus-5-5

Signed-off-by: Gabriel Ribeiro <267068126+gabrielribeiro3105@users.noreply.github.com>
This commit is contained in:
Gabriel Ribeiro 2026-11-26 01:09:04 -08:00 committed by GitHub
parent 7c1de34c6c
commit 4d0486e811
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -472,13 +472,17 @@
(mf/deps url)
(fn [event]
(dom/prevent-default event)
(clipboard/to-clipboard url)
(st/emit! (ntf/show {:level :info
:type :toast
:content (tr "integrations.notification.success.copied-link")
:timeout notification-timeout})
(ev/event {::ev/name "copy-mcp-url"
::ev/origin "integrations"}))))]
(-> (clipboard/to-clipboard url)
(.then (fn [_]
(st/emit! (ntf/show {:level :info
:type :toast
:content (tr "integrations.notification.success.copied-link")
:timeout notification-timeout})
(ev/event {::ev/name "copy-mcp-url"
::ev/origin "integrations"}))))
(.catch (fn [cause]
(st/emit! (ntf/error (or (clipboard/error-message cause)
(tr "errors.clipboard-api-unavailable")))))))))]
[:section {:class (stl/css :mcp-server-section)}
[:div