Skip to content

Commit

Permalink
fix(ui): faulty setInterval -> setTimeout in clipboard (#11945)
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Co-authored-by: Yuan (Terry) Tang <terrytangyuan@gmail.com>
  • Loading branch information
agilgur5 and terrytangyuan committed Oct 10, 2023
1 parent e3ea1ab commit 6b0f047
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ui/src/app/shared/components/clipboard-text.tsx
Expand Up @@ -2,8 +2,8 @@ import {Tooltip} from 'argo-ui';
import * as React from 'react';
import {useState} from 'react';

export const ClipboardText = ({text}: {text: string}) => {
const [justClicked, setJustClicked] = useState<boolean>(false);
export function ClipboardText({text}: {text: string}) {
const [justClicked, setJustClicked] = useState(false);

if (!text) {
return <></>;
Expand All @@ -20,11 +20,11 @@ export const ClipboardText = ({text}: {text: string}) => {
onClick={() => {
setJustClicked(true);
navigator.clipboard.writeText(text);
setInterval(() => setJustClicked(false), 2000);
setTimeout(() => setJustClicked(false), 2000);
}}
/>
</a>
</Tooltip>
</>
);
};
}

0 comments on commit 6b0f047

Please sign in to comment.