Skip to content

Commit 607fa4f

Browse files
Ameclaude
authored andcommitted
fix: initialize select fields with first option when no default is set
Controlled <select> with no matching value caused React state to stay empty while browser visually displayed the first option — user thinks it's selected but onChange never fires, leading to Zod validation failure on submit. Closes #92 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4a7d8bc commit 607fa4f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

ui/src/pages/TradingPage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ function CreateWizard({ brokerTypes, existingAccountIds, onSave, onClose }: {
371371
const defaults: Record<string, unknown> = {}
372372
for (const f of bt.fields) {
373373
if (f.default !== undefined) defaults[f.name] = f.default
374+
else if (f.type === 'select' && f.options?.length) defaults[f.name] = f.options[0].value
374375
}
375376
setBrokerConfig(defaults)
376377
}, [type])

0 commit comments

Comments
 (0)