@@ -290,14 +290,23 @@ function SessionLaunchLink({
290290 ) ;
291291}
292292
293+ interface SessionLaunchLinkCustomizationProps
294+ extends Pick < CustomizeLaunchLinkFormProps , "fields" > {
295+ watch : ReturnType < typeof useForm < EnvVariablesCustomizationForm > > [ "watch" ] ;
296+ }
293297function SessionLaunchLinkCustomization ( {
294298 fields,
295- } : Pick < CustomizeLaunchLinkFormProps , "fields" > ) {
296- const shownFields = fields . filter ( ( field ) => field . isCustomized ) ;
299+ watch,
300+ } : SessionLaunchLinkCustomizationProps ) {
301+ const names = fields . map (
302+ ( _f , i ) => `envVariables.${ i } .isCustomized`
303+ ) as `envVariables.${number } .isCustomized`[ ] ;
304+ const values = watch ( names ) ;
305+ const shownFields = fields . filter ( ( _f , i ) => values [ i ] ) ;
297306 if ( shownFields . length < 1 ) return null ;
298307 return (
299308 < >
300- < Row >
309+ < Row className = "mt-3" >
301310 < Col >
302311 < p > The link and badge above include the following customizations:</ p >
303312 </ Col >
@@ -347,6 +356,7 @@ export default function SessionLaunchLinkModal({
347356 register,
348357 reset,
349358 resetField,
359+ watch,
350360 } = useForm < EnvVariablesCustomizationForm > ( {
351361 defaultValues,
352362 } ) ;
@@ -377,7 +387,7 @@ export default function SessionLaunchLinkModal({
377387 </ ModalHeader >
378388 < ModalBody >
379389 < SessionLaunchLink launcher = { launcher } project = { project } />
380- < SessionLaunchLinkCustomization fields = { fields } />
390+ < SessionLaunchLinkCustomization fields = { fields } watch = { watch } />
381391 < CustomizeLaunchLinkForm
382392 control = { control }
383393 errors = { errors }
0 commit comments