Skip to content

Commit 426ff08

Browse files
Fix enum default not pre-selected when name differs from id
The dropdown matches `selectedItem` by `id`, but `shouldSetDefault` was storing `field.default` (the name) when matching by `name`, causing a mismatch. Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
1 parent 1f6a556 commit 426ff08

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/stores/WizardStore.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,10 @@ class WizardStore {
127127

128128
// Don't use the default if it can't be found in the enum list.
129129
if (isDefaultInEnum) {
130-
return { should: true, value: field.default };
130+
const matchedItem: any = isDefaultInEnum;
131+
const value =
132+
matchedItem.id != null ? matchedItem.id : field.default;
133+
return { should: true, value };
131134
}
132135
} else {
133136
return { should: true, value: field.default };

0 commit comments

Comments
 (0)