Skip to content

fix: handle clipboard API rejection in CopyableAddress#19

Open
Grizouforever wants to merge 1 commit intoentrius:testfrom
Grizouforever:fix/copyable-address-clipboard-error
Open

fix: handle clipboard API rejection in CopyableAddress#19
Grizouforever wants to merge 1 commit intoentrius:testfrom
Grizouforever:fix/copyable-address-clipboard-error

Conversation

@Grizouforever
Copy link
Copy Markdown

Summary

CopyableAddress.handleClick calls navigator.clipboard.writeText() without awaiting or catching the returned Promise. In non-secure contexts (HTTP) or when clipboard permission is denied, this throws an unhandled rejection while still showing "Copied!" feedback.

Changes

src/components/CopyableAddress.tsx: Make handleClick async, await the clipboard write, and catch failures so the "Copied!" tooltip only appears when the copy actually succeeds.

navigator.clipboard.writeText() returns a Promise that was never
awaited or caught. In non-secure contexts (HTTP) or when permission
is denied, this throws an unhandled rejection while still showing
"Copied!" feedback to the user.

Await the Promise and catch failures so the "Copied!" tooltip only
appears when the copy actually succeeds.
@Grizouforever
Copy link
Copy Markdown
Author

Hi! This PR is ready for review — lint and build both pass cleanly. Happy to address any feedback. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant