From 904570f97032523348c6b85e0781a8736d7de264 Mon Sep 17 00:00:00 2001 From: 0xTHAC0 Date: Tue, 18 Aug 2026 16:19:16 +0530 Subject: [PATCH] :bug: Handle clipboard API unavailable on access token copy (#8496) (#11156) When copying an access token over plain HTTP (non-secure context), the browser does not expose navigator.clipboard, causing to-clipboard to return a rejected Promise. The caller was ignoring the Promise entirely, so the rejection became an unhandled exception that crashed the UI. Fix: chain .then/.catch on the returned Promise so that a successful copy shows the existing success toast and a failure (including insecure-origin) shows an error toast using the existing errors.clipboard-api-unavailable translation key. Co-authored-by: Paperclip Co-authored-by: Andrey Antukh --- .../app/main/ui/settings/integrations.cljs | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/frontend/src/app/main/ui/settings/integrations.cljs b/frontend/src/app/main/ui/settings/integrations.cljs index d8c137561a..c87b99ed3b 100644 --- a/frontend/src/app/main/ui/settings/integrations.cljs +++ b/frontend/src/app/main/ui/settings/integrations.cljs @@ -79,13 +79,19 @@ (mf/deps token-created) (fn [event] (dom/prevent-default event) - (clipboard/to-clipboard (:token token-created)) - (st/emit! (ntf/show {:level :info - :type :toast - :content (if is-mcp - (tr "integrations.notification.success.mcp-key-copied") - (tr "integrations.notification.success.token-copied")) - :timeout notification-timeout}))))] + (-> (clipboard/to-clipboard (:token token-created)) + (.then (fn [_] + (st/emit! (ntf/show {:level :info + :type :toast + :content (if is-mcp + (tr "integrations.notification.success.mcp-key-copied") + (tr "integrations.notification.success.token-copied")) + :timeout notification-timeout})))) + (.catch (fn [_] + (st/emit! (ntf/show {:level :error + :type :toast + :content (tr "errors.clipboard-api-unavailable") + :timeout notification-timeout})))))))] [:div {:class (stl/css :modal-form)} [:> text* {:as "h2"