diff --git a/imports/cyto-react-links-card.tsx b/imports/cyto-react-links-card.tsx index 31acd8ca..fc4746aa 100644 --- a/imports/cyto-react-links-card.tsx +++ b/imports/cyto-react-links-card.tsx @@ -208,6 +208,7 @@ export const CytoReactLinksCard = React.memo(({ }) => { const [switchLayout, setSwitchLayout] = useState('grid'); const [selectedLink, setSelectedLink] = useState(selectedLinkId); + const [isSubmitting, setIsSubmitting] = useState(false); const inputRef = useRef(null); const gray900 = useChackraColor('gray.900'); @@ -365,7 +366,18 @@ export const CytoReactLinksCard = React.memo(({ // color='white' aria-label='submit button' icon={} - onClick={() => onSubmit && onSubmit(selectedLink)} + onClick={() => { + if (isSubmitting) return; + setIsSubmitting(true); + if (onSubmit && selectedLink) { + try { + await onSubmit(selectedLink); + } finally { + setIsSubmitting(false); + } + } + }} + isDisabled={isSubmitting} /> {!!onClose && @@ -379,4 +391,4 @@ export const CytoReactLinksCard = React.memo(({ /> } ); -}) \ No newline at end of file +})