fix: use disableToasts for handling notifications in EventTypeSettings atom (#23490)
* fix: use disableToasts for handling notifications * add changesets
This commit is contained in:
1 parent
c0a59a2837
commit
de98578fdd
2 files changed
+19
-4
No files matched your search
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@calcom/atoms": patch
|
||||
---
|
||||
|
||||
This PR fixes the prop `disableToasts` not working
|
||||
@@ -96,14 +96,18 @@ const EventType = forwardRef<
|
||||
const { data: user, isLoading: isUserLoading } = useMe();
|
||||
|
||||
const handleDeleteSuccess = () => {
|
||||
showToast(t("event_type_deleted_successfully"), "success");
|
||||
if (!disableToasts) {
|
||||
showToast(t("event_type_deleted_successfully"), "success");
|
||||
}
|
||||
isTeamEventTypeDeleted.current = true;
|
||||
setSlugExistsChildrenDialogOpen([]);
|
||||
onDeleteSuccess?.();
|
||||
};
|
||||
|
||||
const handleDeleteError = (err: Error) => {
|
||||
showToast(err.message, "error");
|
||||
if (!disableToasts) {
|
||||
showToast(err.message, "error");
|
||||
}
|
||||
onDeleteError?.(err.message);
|
||||
};
|
||||
|
||||
@@ -137,7 +141,9 @@ const EventType = forwardRef<
|
||||
|
||||
// Reset the form with these values as new default values to ensure the correct comparison for dirtyFields eval
|
||||
form.reset(currentValues);
|
||||
toast({ description: t("event_type_updated_successfully", { eventTypeTitle: eventType.title }) });
|
||||
if (!disableToasts) {
|
||||
toast({ description: t("event_type_updated_successfully", { eventTypeTitle: eventType.title }) });
|
||||
}
|
||||
onSuccess?.(currentValues);
|
||||
callbacksRef.current?.onSuccess?.();
|
||||
},
|
||||
@@ -148,7 +154,9 @@ const EventType = forwardRef<
|
||||
const currentValues = form.getValues();
|
||||
const message = err?.message;
|
||||
const description = message ? t(message) : t(err.message);
|
||||
toast({ description });
|
||||
if (!disableToasts) {
|
||||
toast({ description });
|
||||
}
|
||||
onError?.(currentValues, err);
|
||||
|
||||
const errorObj = new Error(description);
|
||||
@@ -386,6 +394,7 @@ export const EventTypePlatformWrapper = forwardRef<
|
||||
allowDelete = true,
|
||||
customClassNames,
|
||||
isDryRun,
|
||||
disableToasts,
|
||||
onFormStateChange,
|
||||
} = props;
|
||||
const { data: eventTypeQueryData } = useAtomsEventTypeById(id);
|
||||
@@ -421,6 +430,7 @@ export const EventTypePlatformWrapper = forwardRef<
|
||||
isDryRun={isDryRun}
|
||||
onFormStateChange={onFormStateChange}
|
||||
ref={ref}
|
||||
disableToasts={disableToasts}
|
||||
/>
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user