Skip to content

Commit dd4ec08

Browse files
committed
fix: use nullhclstring
1 parent e02b1c3 commit dd4ec08

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

site/src/DynamicForm.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export function DynamicForm() {
115115
response.parameters.forEach((param) => {
116116
// If the server-sent param.Value is empty, we can fall back to `default_value`
117117
defaultValues[param.name] =
118-
param.value || param.default_value || "";
118+
param.value.value || param.default_value.value || "";
119119
});
120120

121121
// Use RHF's `reset` to update the entire form
@@ -194,7 +194,7 @@ export function DynamicForm() {
194194
render={({ field }) => (
195195
<Select
196196
onValueChange={field.onChange}
197-
defaultValue={param.default_value}
197+
defaultValue={param.default_value.value}
198198
>
199199
<SelectTrigger className="w-[300px]">
200200
<SelectValue placeholder={param.description} />
@@ -204,7 +204,7 @@ export function DynamicForm() {
204204
{(param.options || []).map((option, idx) => {
205205
if (!option) return null;
206206
return (
207-
<SelectItem key={idx} value={option.value}>{option.name}</SelectItem>
207+
<SelectItem key={idx} value={option.value.value}>{option.name}</SelectItem>
208208
);
209209
})}
210210
</SelectGroup>
@@ -237,7 +237,7 @@ export function DynamicForm() {
237237
field.onChange(values);
238238
}}
239239
options={param.options?.map(opt => ({
240-
value: opt?.value || '',
240+
value: opt?.value?.value || '',
241241
label: opt?.name || '',
242242
disabled: false
243243
})) || []}
@@ -264,7 +264,7 @@ export function DynamicForm() {
264264
{param.display_name || param.name}
265265
{param.icon && <img src={param.icon} alt="" style={{ marginLeft: 6 }} />}
266266
</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>
268268
</div>
269269
{param.description && <div className="text-sm">{param.description}</div>}
270270
<Controller
@@ -290,21 +290,21 @@ export function DynamicForm() {
290290
{param.display_name || param.name}
291291
{param.icon && <img src={param.icon} alt="" style={{ marginLeft: 6 }} />}
292292
</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>
294294
</div>
295295
{param.description && <div className="text-sm">{param.description}</div>}
296296
<Controller
297297
name={param.name}
298298
control={methods.control}
299299
render={({ field }) => (
300300
<div className="w-[300px]">
301-
<RadioGroup defaultValue={param.default_value} onValueChange={field.onChange}>
301+
<RadioGroup defaultValue={param.default_value.value} onValueChange={field.onChange}>
302302
{(param.options || []).map((option, idx) => {
303303
if (!option) return null;
304304
return (
305305
<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>
308308
</div>
309309
);
310310
})}
@@ -333,7 +333,7 @@ export function DynamicForm() {
333333
render={({ field }) => (
334334
<Select
335335
onValueChange={field.onChange}
336-
defaultValue={param.value}
336+
defaultValue={param.value.value}
337337
>
338338
<SelectTrigger className="w-[300px]">
339339
<SelectValue placeholder={param.description} />
@@ -343,7 +343,7 @@ export function DynamicForm() {
343343
{(param.options || []).map((option, idx) => {
344344
if (!option) return null;
345345
return (
346-
<SelectItem key={idx} value={option.value}>{option.name}</SelectItem>
346+
<SelectItem key={idx} value={option.value.value}>{option.name}</SelectItem>
347347
);
348348
})}
349349
</SelectGroup>
@@ -374,7 +374,7 @@ export function DynamicForm() {
374374
className="w-[300px]"
375375
type={mapParamTypeToInputType(param.type)}
376376
value={field.value}
377-
defaultValue={param.default_value}
377+
defaultValue={param.default_value.value}
378378
/>
379379
)}
380380
/>

0 commit comments

Comments
 (0)