mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 15:47:53 -05:00
fix(studio): prevent duplicate submissions on studio project browser modal
This commit is contained in:
parent
e835cafc37
commit
54b9161dc0
1 changed files with 1 additions and 0 deletions
|
@ -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))
|
||||||
|
|
Loading…
Reference in a new issue