Skip to content

Commit

Permalink
fix: allow to clear select in meta fields (#294)
Browse files Browse the repository at this point in the history
Co-authored-by: Akanksh Saxena <akanksh.saxena@adfinis-sygroup.ch>
  • Loading branch information
aziiee and Akanksh Saxena authored Oct 22, 2021
1 parent e49b910 commit 6428909
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion addon/components/meta-fields.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
<PowerSelect
@disabled={{field.readOnly}}
@options={{field.options}}
@selected={{find-by "value" (get @model.meta field.slug) @field.options}}
@selected={{find-by "value" (get @model.meta field.slug) field.options}}
@onChange={{fn this.updateMetaField field @model}}
@placeholder={{concat (get field.label this.intl.primaryLocale) "..."}}
@allowClear={{true}}
as |option|
>
{{get option.label this.intl.primaryLocale}}
Expand Down
2 changes: 1 addition & 1 deletion addon/components/meta-fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class EditFormComponent extends Component {

@action
updateMetaField(field, model, optionOrEvent) {
const value = optionOrEvent.target?.value ?? optionOrEvent.value;
const value = optionOrEvent?.target?.value ?? optionOrEvent?.value;
model.meta = { ...model.meta, [field.slug]: value };
model.notifyPropertyChange("meta");
}
Expand Down

0 comments on commit 6428909

Please sign in to comment.