Skip to content

bug: “Copied” state can get stuck or reset incorrectly due to missing cleanup #3604

@Aditya8369

Description

@Aditya8369

Description

copyToClipboard sets copied=true and then schedules setTimeout(() => setCopied(false), 50000). There is no cleanup when the component unmounts or when a subsequent copy happens quickly—leading to:

“Copied” badge potentially turning off at unexpected times
timers lingering after navigation

Steps to Reproduce

Click “Copy Link” multiple times quickly.
Navigate away from the page within ~1 minute.
Return back to the page (or observe in React devtools).

Expected Behavior

“Copied” should:
only reflect the latest copy action
clear timers on unmount
never cause delayed state changes after navigation

Screenshots / Logs

No response

GitHub Username (If applicable)

No response

Environment

Chrome

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions