Skip to content

Commit

Permalink
fix: set initial value of fixed-source select fields, if provided
Browse files Browse the repository at this point in the history
If the initial value provided by the user does not match the field's options, the field's value will be blank (previously, the first option would be selected by default).
  • Loading branch information
LandingEllipse committed May 14, 2024
1 parent f8348ae commit 8864226
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/FormModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ export class FormModal extends Modal {
fieldInput.options.forEach((option) => {
element.addOption(option.value, option.label);
});
initialValue !== undefined && element.setValue(String(initialValue));
fieldStore.value.set(element.getValue());
element.onChange(fieldStore.value.set);
});
Expand Down

0 comments on commit 8864226

Please sign in to comment.