@@ -2,17 +2,13 @@ import { useAutoAnimate } from "@formkit/auto-animate/react";
22import { ErrorMessage } from "@hookform/error-message" ;
33import Link from "next/link" ;
44import { useEffect , useState } from "react" ;
5- import { useFieldArray , useFormContext } from "react-hook-form" ;
5+ import { useFieldArray } from "react-hook-form" ;
66import type { UseFormGetValues , UseFormSetValue , Control , FormState } from "react-hook-form" ;
77
88import type { EventLocationType } from "@calcom/app-store/locations" ;
99import { getEventLocationType , MeetLocationType } from "@calcom/app-store/locations" ;
1010import { useIsPlatform } from "@calcom/atoms/hooks/useIsPlatform" ;
11- import type {
12- LocationFormValues ,
13- EventTypeSetupProps ,
14- FormValues ,
15- } from "@calcom/features/eventtypes/lib/types" ;
11+ import type { LocationFormValues , EventTypeSetupProps } from "@calcom/features/eventtypes/lib/types" ;
1612import CheckboxField from "@calcom/features/form/components/CheckboxField" ;
1713import type { SingleValueLocationOption } from "@calcom/features/form/components/LocationSelect" ;
1814import LocationSelect from "@calcom/features/form/components/LocationSelect" ;
@@ -34,10 +30,6 @@ export type TLocationOptions = Pick<EventTypeSetupProps, "locationOptions">["loc
3430export type TDestinationCalendar = { integration : string } | null ;
3531export type TPrefillLocation = { credentialId ?: number ; type : string } ;
3632
37- type LocationInputCustomClassNames = {
38- addressInput ?: string ;
39- phoneInput ?: string ;
40- } ;
4133
4234type LocationsProps = {
4335 team : { id : number } | null ;
@@ -96,7 +88,7 @@ const Locations: React.FC<LocationsProps> = ({
9688 disableLocationProp,
9789 isManagedEventType,
9890 getValues,
99- setValue,
91+ setValue : _setValue ,
10092 control,
10193 formState,
10294 team,
@@ -116,8 +108,6 @@ const Locations: React.FC<LocationsProps> = ({
116108 name : "locations" ,
117109 } ) ;
118110
119- const formMethods = useFormContext < FormValues > ( ) ;
120-
121111 const locationOptions = props . locationOptions . map ( ( locationOption ) => {
122112 const options = locationOption . options . filter ( ( option ) => {
123113 // Skip "Organizer's Default App" for non-team members
@@ -172,8 +162,7 @@ const Locations: React.FC<LocationsProps> = ({
172162 setSelectedNewOption ( prefillLocation ) ;
173163 }
174164 }
175- // eslint-disable-next-line react-hooks/exhaustive-deps
176- } , [ prefillLocation , seatsEnabled ] ) ;
165+ } , [ prefillLocation , seatsEnabled , validLocations , append ] ) ;
177166
178167 const isPlatform = useIsPlatform ( ) ;
179168
@@ -250,6 +239,7 @@ const Locations: React.FC<LocationsProps> = ({
250239 type = "button"
251240 onClick = { ( ) => {
252241 remove ( index ) ;
242+ setSelectedNewOption ( null ) ;
253243 } }
254244 aria-label = { t ( "remove" ) } >
255245 < div className = "h-4 w-4" >
0 commit comments