fix: handle clipboard write failure in CopyButton, remove duplicate catch#1765
Merged
lalalune merged 1 commit intomilady-ai:developfrom Apr 10, 2026
Merged
Conversation
…e catch
CopyButton previously showed "copied" feedback even when the clipboard
write failed (e.g. permission denied, insecure context). Now the check
icon only appears on successful writes. Also cleans up the feedback
timer on unmount to prevent setState on unmounted components.
Removes a duplicate .catch(() => {}) in useDataLoaders that was
unreachable dead code from a copy-paste error.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Agent Review — Service UnavailableBoth AI reviewers failed to complete the review for this run:
This is likely a temporary API outage. The PR will need to be re-reviewed once services recover.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
packages/ui/src/components/ui/copy-button.tsx): Previously usedvoid navigator.clipboard.writeText(value)which fires-and-forgets the clipboard write, then immediately shows the "copied" checkmark — even when the write fails (permission denied, insecure context, etc.). Now the component awaits the promise and only shows success feedback on actual success.setTimeoutthat resets the copied state was never cleaned up on unmount, which could callsetCopiedon an unmounted component. Added auseRef+ cleanupuseEffectto clear the timer.packages/app-core/src/state/useDataLoaders.ts): Removed a duplicate.catch(() => {})that was chained after an identical.catch(() => {})— the second handler is unreachable dead code (a caught promise resolves toundefined, so the second catch never fires).Test plan
🤖 Generated with Claude Code