@assistant-ui/react 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.mjs CHANGED
@@ -529,9 +529,10 @@ var useActionBarCopy = ({
529
529
  const { setIsCopied } = useMessageUtils.getState();
530
530
  const { isEditing, value: composerValue } = useEditComposer.getState();
531
531
  const valueToCopy = isEditing ? composerValue : getMessageText(message);
532
- navigator.clipboard.writeText(valueToCopy);
533
- setIsCopied(true);
534
- setTimeout(() => setIsCopied(false), copiedDuration);
532
+ navigator.clipboard.writeText(valueToCopy).then(() => {
533
+ setIsCopied(true);
534
+ setTimeout(() => setIsCopied(false), copiedDuration);
535
+ });
535
536
  }, [useMessage, useMessageUtils, useEditComposer, copiedDuration]);
536
537
  if (!hasCopyableContent) return null;
537
538
  return callback;