@@ -115,7 +115,7 @@ export function DynamicForm() {
115
115
response . parameters . forEach ( ( param ) => {
116
116
// If the server-sent param.Value is empty, we can fall back to `default_value`
117
117
defaultValues [ param . name ] =
118
- param . value || param . default_value || "" ;
118
+ param . value . value || param . default_value . value || "" ;
119
119
} ) ;
120
120
121
121
// Use RHF's `reset` to update the entire form
@@ -194,7 +194,7 @@ export function DynamicForm() {
194
194
render = { ( { field } ) => (
195
195
< Select
196
196
onValueChange = { field . onChange }
197
- defaultValue = { param . default_value }
197
+ defaultValue = { param . default_value . value }
198
198
>
199
199
< SelectTrigger className = "w-[300px]" >
200
200
< SelectValue placeholder = { param . description } />
@@ -204,7 +204,7 @@ export function DynamicForm() {
204
204
{ ( param . options || [ ] ) . map ( ( option , idx ) => {
205
205
if ( ! option ) return null ;
206
206
return (
207
- < SelectItem key = { idx } value = { option . value } > { option . name } </ SelectItem >
207
+ < SelectItem key = { idx } value = { option . value . value } > { option . name } </ SelectItem >
208
208
) ;
209
209
} ) }
210
210
</ SelectGroup >
@@ -237,7 +237,7 @@ export function DynamicForm() {
237
237
field . onChange ( values ) ;
238
238
} }
239
239
options = { param . options ?. map ( opt => ( {
240
- value : opt ?. value || '' ,
240
+ value : opt ?. value ?. value || '' ,
241
241
label : opt ?. name || '' ,
242
242
disabled : false
243
243
} ) ) || [ ] }
@@ -264,7 +264,7 @@ export function DynamicForm() {
264
264
{ param . display_name || param . name }
265
265
{ param . icon && < img src = { param . icon } alt = "" style = { { marginLeft : 6 } } /> }
266
266
</ label >
267
- < output className = "text-sm font-medium tabular-nums" > { param . value } </ output >
267
+ < output className = "text-sm font-medium tabular-nums" > { param . value . value } </ output >
268
268
</ div >
269
269
{ param . description && < div className = "text-sm" > { param . description } </ div > }
270
270
< Controller
@@ -290,21 +290,21 @@ export function DynamicForm() {
290
290
{ param . display_name || param . name }
291
291
{ param . icon && < img src = { param . icon } alt = "" style = { { marginLeft : 6 } } /> }
292
292
</ label >
293
- < output className = "text-sm font-medium tabular-nums" > { param . value } </ output >
293
+ < output className = "text-sm font-medium tabular-nums" > { param . value . value } </ output >
294
294
</ div >
295
295
{ param . description && < div className = "text-sm" > { param . description } </ div > }
296
296
< Controller
297
297
name = { param . name }
298
298
control = { methods . control }
299
299
render = { ( { field } ) => (
300
300
< div className = "w-[300px]" >
301
- < RadioGroup defaultValue = { param . default_value } onValueChange = { field . onChange } >
301
+ < RadioGroup defaultValue = { param . default_value . value } onValueChange = { field . onChange } >
302
302
{ ( param . options || [ ] ) . map ( ( option , idx ) => {
303
303
if ( ! option ) return null ;
304
304
return (
305
305
< div key = { idx } className = "flex items-center space-x-2" >
306
- < RadioGroupItem value = { option . value } id = { option . value } />
307
- < Label htmlFor = { option . value } > { option . name } </ Label >
306
+ < RadioGroupItem value = { option . value . value } id = { option . value . value } />
307
+ < Label htmlFor = { option . value . value } > { option . name } </ Label >
308
308
</ div >
309
309
) ;
310
310
} ) }
@@ -333,7 +333,7 @@ export function DynamicForm() {
333
333
render = { ( { field } ) => (
334
334
< Select
335
335
onValueChange = { field . onChange }
336
- defaultValue = { param . value }
336
+ defaultValue = { param . value . value }
337
337
>
338
338
< SelectTrigger className = "w-[300px]" >
339
339
< SelectValue placeholder = { param . description } />
@@ -343,7 +343,7 @@ export function DynamicForm() {
343
343
{ ( param . options || [ ] ) . map ( ( option , idx ) => {
344
344
if ( ! option ) return null ;
345
345
return (
346
- < SelectItem key = { idx } value = { option . value } > { option . name } </ SelectItem >
346
+ < SelectItem key = { idx } value = { option . value . value } > { option . name } </ SelectItem >
347
347
) ;
348
348
} ) }
349
349
</ SelectGroup >
@@ -374,7 +374,7 @@ export function DynamicForm() {
374
374
className = "w-[300px]"
375
375
type = { mapParamTypeToInputType ( param . type ) }
376
376
value = { field . value }
377
- defaultValue = { param . default_value }
377
+ defaultValue = { param . default_value . value }
378
378
/>
379
379
) }
380
380
/>
0 commit comments