How best to prevent double button clicks and duplicate / parallel mutations #10041
Unanswered
mpvosseller
asked this question in
General
Replies: 1 comment 1 reply
-
|
Does this differ from when you have a flag in local state that you set when the button is clicked? Because the component should re-render immediately with |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Sometimes we find users are able to accidentally double click a button and kick off duplicate / parallel mutations.
We disable the button when
mutation.isPendingistruebut that isn't set immediately on mutate so there is a short time window when it's possible to double click the button and kick off extra mutations.Wondering if others experience this and if anyone has adopted a clean workaround? Or do folks live with the race condition?
Thanks!
Our buttons look like this:
And our event handlers looks like this:
Beta Was this translation helpful? Give feedback.
All reactions