fix: Toggling really fast throws internal errors (#12580)
This commit is contained in:
parent
f19a1926b4
commit
bd6ca21e02
|
@ -67,7 +67,7 @@ const CalendarSwitch = (props: ICalendarSwitchProps) => {
|
|||
},
|
||||
onError() {
|
||||
setCheckedInternal(false);
|
||||
showToast(`Something went wrong when toggling "${title}""`, "error");
|
||||
showToast(`Something went wrong when toggling "${title}"`, "error");
|
||||
},
|
||||
}
|
||||
);
|
||||
|
@ -77,9 +77,10 @@ const CalendarSwitch = (props: ICalendarSwitchProps) => {
|
|||
<Switch
|
||||
id={externalId}
|
||||
checked={checkedInternal}
|
||||
onCheckedChange={(isOn: boolean) => {
|
||||
disabled={mutation.isLoading}
|
||||
onCheckedChange={async (isOn: boolean) => {
|
||||
setCheckedInternal(isOn);
|
||||
mutation.mutate({ isOn });
|
||||
await mutation.mutate({ isOn });
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user