fix(studio): prevent duplicate submissions on studio project browser modal

This commit is contained in:
Paul Kaplan 2021-07-01 13:36:29 -04:00
parent e835cafc37
commit 54b9161dc0

View file

@ -10,6 +10,7 @@ const UserProjectsTile = ({id, title, image, inStudio, onAdd, onRemove}) => {
const [added, setAdded] = useState(inStudio); const [added, setAdded] = useState(inStudio);
const {errorAlert} = useContext(AlertContext); const {errorAlert} = useContext(AlertContext);
const toggle = () => { const toggle = () => {
if (submitting) return;
setSubmitting(true); setSubmitting(true);
const adding = !added; // for clarity, the current action is opposite of previous state const adding = !added; // for clarity, the current action is opposite of previous state
(adding ? onAdd(id) : onRemove(id)) (adding ? onAdd(id) : onRemove(id))