Skip to content

fix(components): clean up share button copy timeout on unmount and dialog close - #471

Closed
ranjeet150 wants to merge 1 commit into
ChainLearnOfficial:mainfrom
ranjeet150:fix/share-button-timeout-cleanup-455
Closed

ranjeet150 wants to merge 1 commit into
ChainLearnOfficial:mainfrom
ranjeet150:fix/share-button-timeout-cleanup-455

Conversation

@ranjeet150

Copy link
Copy Markdown

Summary

Cleans up the 2-second copy timeout in ShareButton when the component unmounts or when the share dialog is closed, preventing state updates on unmounted components and avoiding stale state interference.

Changes

  • Stored setTimeout reference in copyTimeoutRef.
  • Added unmount cleanup hook to clear any active copy timeout.
  • Added handleOpenChange callback on Dialog to clear timeout and reset copied to false when dismissed.
  • Added comprehensive unit tests in src/components/shared/share-button.test.tsx (all 3 tests pass).

Closes #455

@netlify

netlify Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

❌ Deploy Preview for chainlearn failed.

Name Link
🔨 Latest commit beb4def
🔍 Latest deploy log https://app.netlify.com/projects/chainlearn/deploys/6ab9e00f06a8a700084994ab

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.

Share button setTimeout cleanup missing — potential stale state

2 participants