mirror of
https://github.com/penpot/penpot.git
synced 2026-11-26 21:00:32 +00:00
🐛 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:
parent
7c1de34c6c
commit
4d0486e811
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user