Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix: report copy analytics only after a successful clipboard write

Richie McIlroy1fcd62f1c5f2
diff --git a/apps/web/components/pages/agents/copy.tsx b/apps/web/components/pages/agents/copy.tsx
index e96af265a..6ac973565 100644
--- a/apps/web/components/pages/agents/copy.tsx
+++ b/apps/web/components/pages/agents/copy.tsx
@@ -79,8 +79,9 @@ export const CopyIconButton = ({
type="button"
aria-label={copied ? `${label} copied` : `Copy ${label}`}
onClick={() => {
- onCopy?.();
- void copy(text);
+ void copy(text).then((ok) => {
+ if (ok) onCopy?.();
+ });
}}
className={classNames(
"grid size-8 shrink-0 place-items-center rounded-[8px] transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2",
@@ -132,8 +133,9 @@ export const CopyLabelButton = ({
<button
type="button"
onClick={() => {
- onCopy?.();
- void copy(text);
+ void copy(text).then((ok) => {
+ if (ok) onCopy?.();
+ });
}}
className={classNames(className, "gap-2.5")}
>