Hotfix/Event Type Save Error with Multiple Durations (#6154)

* Fix .length being undefined when form is submitted without any change to duration

* Fix type error

Co-authored-by: Alex van Andel <[email protected]>
This commit is contained in:
Hariom BalharaandAlex van Andel authored and GitHub committed 2022-12-22 11:13:33 +00:00
1 parent 64ecce1ccb
commit a076418989
2 files changed
+14 -6

No files matched your search

@@ -290,7 +290,7 @@ export const EventSetupTab = (
setDefaultDuration(
selectedMultipleDuration.find((opt) => opt.value === option?.value) ?? null
);
formMethods.setValue("length", Number(option?.value));
if (option) formMethods.setValue("length", option.value);
}}
/>
</div>
@@ -298,14 +298,11 @@ export const EventSetupTab = (
) : (
<TextField
required
name="length"
type="number"
label={t("duration")}
addOnSuffix={<>{t("minutes")}</>}
defaultValue={eventType.length ?? 15}
onChange={(e) => {
formMethods.setValue("length", Number(e.target.value));
}}
{...formMethods.register("length")}
addOnSuffix={<>{t("minutes")}</>}
/>
)}
<div className="!mt-4 [&_label]:my-1 [&_label]:font-normal">