Skip to content

Fix: copyAddress in WalletPage has no error handling — clipboard failures are silent #594

Description

@henrypeters

Category: Frontend - Bug
Priority: Low
Estimated Time: 30 minutes

Description:
app/(app)/wallet/page.tsx calls navigator.clipboard.writeText() in an async function without a try/catch. The Clipboard API throws in non-secure contexts and can be denied by browser permissions. A failed copy silently leaves copied as false with no user feedback, making the user believe the copy succeeded or failed with no explanation.

// app/(app)/wallet/page.tsx
async function copyAddress() {
  if (!wallet) return
  await navigator.clipboard.writeText(wallet.address)  // unhandled rejection
  setCopied(true)
  setTimeout(() => setCopied(false), 2000)
}

Tasks:

  • Wrap the clipboard call in try/catch
  • On failure, show a toast or an inline error: "Could not copy — please select and copy the address manually"
  • Add a test mocking a clipboard permission denial

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinguxUser experiencewalletWallet connection and session

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions