@@ -26,6 +26,7 @@ import { Stack } from "components/Stack/Stack";
2626import { Switch } from "components/Switch/Switch" ;
2727import { UserAutocomplete } from "components/UserAutocomplete/UserAutocomplete" ;
2828import { type FormikContextType , useFormik } from "formik" ;
29+ import { useEffectEvent } from "hooks/hookPolyfills" ;
2930import type { ExternalAuthPollingState } from "hooks/useExternalAuth" ;
3031import { ExternalLinkIcon } from "lucide-react" ;
3132import { linkToTemplate , useLinks } from "modules/navigation" ;
@@ -162,7 +163,7 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
162163 ] ) ;
163164 const [ selectedPresetIndex , setSelectedPresetIndex ] = useState ( 0 ) ;
164165 // Build options and keep default label/value in sync
165- useEffect ( ( ) => {
166+ useEffectEvent ( ( ) => {
166167 const options = [
167168 { displayName : "None" , value : "undefined" , icon : "" , description : "" } ,
168169 ...presets . map ( ( preset ) => ( {
@@ -182,12 +183,12 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
182183 setSelectedPresetIndex ( 0 ) ; // Explicitly set to "None"
183184 form . setFieldValue ( "template_version_preset_id" , undefined ) ;
184185 }
185- } , [ presets , form . setFieldValue ] ) ;
186+ } ) ;
186187
187188 const [ presetParameterNames , setPresetParameterNames ] = useState < string [ ] > (
188189 [ ] ,
189190 ) ;
190- useEffect ( ( ) => {
191+ useEffectEvent ( ( ) => {
191192 const selectedPresetOption = presetOptions [ selectedPresetIndex ] ;
192193 let selectedPreset : TypesGen . Preset | undefined ;
193194 for ( const preset of presets ) {
@@ -217,13 +218,7 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
217218 value : presetParameter . Value ,
218219 } ) ;
219220 }
220- } , [
221- presetOptions ,
222- selectedPresetIndex ,
223- presets ,
224- parameters ,
225- form . setFieldValue ,
226- ] ) ;
221+ } ) ;
227222
228223 return (
229224 < Margins size = "medium" >
0 commit comments