Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

Commit

Permalink
fix: Toggling really fast throws internal errors (calcom#12580)
Browse files Browse the repository at this point in the history
  • Loading branch information
emrysal authored Nov 28, 2023
1 parent f19a192 commit bd6ca21
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/features/calendars/CalendarSwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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");
},
}
);
Expand All @@ -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>
Expand Down

0 comments on commit bd6ca21

Please sign in to comment.