mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-11 08:42:39 +02:00
Merge pull request #955 from LikiosSedo/fix/clear-timeout-code-block
fix: add missing `clearTimeout` cleanup in CopyButton useEffect
This commit is contained in:
commit
7014adb95b
1 changed files with 3 additions and 1 deletions
|
|
@ -143,9 +143,11 @@ function CopyButton({
|
|||
const [hasCopied, setHasCopied] = React.useState(false);
|
||||
|
||||
React.useEffect(() => {
|
||||
setTimeout(() => {
|
||||
if (!hasCopied) return;
|
||||
const timer = setTimeout(() => {
|
||||
setHasCopied(false);
|
||||
}, 2000);
|
||||
return () => clearTimeout(timer);
|
||||
}, [hasCopied]);
|
||||
|
||||
return (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue