Skip to content

Commit 81110da

Browse files
mihaelabalutoiuDany9966
authored andcommitted
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 98c35d6 commit 81110da

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/stores/WizardStore.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ 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 = matchedItem.id != null ? matchedItem.id : field.default;
132+
return { should: true, value };
131133
}
132134
} else {
133135
return { should: true, value: field.default };

0 commit comments

Comments
 (0)