mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-02 19:55:18 +02:00
fix: clear setTimeout on useEffect cleanup (issue #1095)
- Fixed setTimeout cleanup for copy-feedback timer - Ensures timer is properly cleared when component unmounts - Moves cleanup return outside conditional to guarantee cleanup runs
This commit is contained in:
parent
805eacb9fc
commit
479e141e8f
1 changed files with 4 additions and 4 deletions
|
|
@ -17,10 +17,10 @@ export function useApiKey(): UseApiKeyReturn {
|
||||||
|
|
||||||
// Clear copied state after 2 seconds
|
// Clear copied state after 2 seconds
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (copied) {
|
if (!copied) return;
|
||||||
const timer = setTimeout(() => setCopied(false), 2000);
|
|
||||||
return () => clearTimeout(timer);
|
const timer = setTimeout(() => setCopied(false), 2000);
|
||||||
}
|
return () => clearTimeout(timer);
|
||||||
}, [copied]);
|
}, [copied]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue