Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit 9049c83

Browse files
committed
fix: trigger reservation form validators on input
1 parent b438610 commit 9049c83

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

apps/ui/components/reservation/Step0.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import type { OptionType } from "common/types/common";
66
import { IconArrowLeft, IconArrowRight } from "hds-react";
77
import { useFormContext } from "react-hook-form";
8-
import React from "react";
8+
import React, { useState } from "react";
99
import { Trans, useTranslation } from "next-i18next";
1010
import styled from "styled-components";
1111
import { fontMedium, fontRegular } from "common/src/common/typography";
@@ -75,7 +75,7 @@ const Step0 = ({
7575
}: Props): JSX.Element => {
7676
const { t } = useTranslation();
7777

78-
const [isDialogOpen, setIsDialogOpen] = React.useState(false);
78+
const [isDialogOpen, setIsDialogOpen] = useState(false);
7979

8080
const termsOfUse = getTranslation(reservationUnit, "termsOfUse");
8181

apps/ui/pages/reservation-unit/[...params].tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ function ReservationUnitReservation(props: PropsNarrowed): JSX.Element | null {
174174
// TODO is defaultValues correct? it's prefilled from the profile data and we are not refetching at any point.
175175
// If we would refetch values would be more correct with reset hook.
176176
// Also if this is ever initialised without the data it will not prefill the form.
177-
const form = useForm<Inputs>({ defaultValues, mode: "onBlur" });
177+
const form = useForm<Inputs>({ defaultValues, mode: "onChange" });
178178
const { handleSubmit, watch } = form;
179179

180180
const reserveeType = watch("reserveeType");

0 commit comments

Comments
 (0)