Fix: lock timezone on booking page breaks atoms (#23060)

* fix: eventTypeSettings atom crashed on enabling `Lock timezone on booking page`

* add changelog
This commit is contained in:
Somay Chauhan authored and GitHub committed 2025-08-13 13:03:35 +00:00
1 parent b7fda31678
commit 293dd1a140
3 files changed
+33 -20

No files matched your search

@@ -150,7 +150,7 @@ const EventType = forwardRef<
const description = message ? t(message) : t(err.message);
toast({ description });
onError?.(currentValues, err);
const errorObj = new Error(description);
callbacksRef.current?.onError?.(errorObj);
},
@@ -175,24 +175,27 @@ const EventType = forwardRef<
const callbacksRef = useRef<{ onSuccess?: () => void; onError?: (error: Error) => void }>({});
const handleFormSubmit = useCallback((customCallbacks?: { onSuccess?: () => void; onError?: (error: Error) => void }) => {
if (customCallbacks) {
callbacksRef.current = customCallbacks;
}
const handleFormSubmit = useCallback(
(customCallbacks?: { onSuccess?: () => void; onError?: (error: Error) => void }) => {
if (customCallbacks) {
callbacksRef.current = customCallbacks;
}
if (saveButtonRef.current) {
saveButtonRef.current.click();
} else {
form.handleSubmit((data) => {
try {
handleSubmit(data);
customCallbacks?.onSuccess?.();
} catch (error) {
customCallbacks?.onError?.(error as Error);
}
})();
}
}, [handleSubmit, form]);
if (saveButtonRef.current) {
saveButtonRef.current.click();
} else {
form.handleSubmit((data) => {
try {
handleSubmit(data);
customCallbacks?.onSuccess?.();
} catch (error) {
customCallbacks?.onError?.(error as Error);
}
})();
}
},
[handleSubmit, form]
);
const validateForm = useCallback(async () => {
const isValid = await form.trigger();