Skip to content

Commit

Permalink
FIO-9205: fixed an issue where Select Filter feature does not work
Browse files Browse the repository at this point in the history
  • Loading branch information
KatrinKhilko authored and lane-formio committed Oct 29, 2024
1 parent e1f844d commit f60425a
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/components/select/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ export default class SelectComponent extends ListComponent {
return super.normalizeValue(this.normalizeSingleValue(value));
}

setMetadata(value) {
setMetadata(value, flags = {}) {
if (_.isNil(value)) {
return;
}
Expand Down Expand Up @@ -1491,16 +1491,23 @@ export default class SelectComponent extends ListComponent {

_.set(submission.metadata.selectData, this.path, templateData);
}
if (flags.resetValue && this.root?.submission) {
const submission = this.root.submission;
if (!submission.metadata) {
submission.metadata = {};
}
submission.metadata.selectData = {};
}
}

updateValue(value, flags) {
const changed = super.updateValue(value, flags);
if (changed || !this.selectMetadata) {
if (changed || !this.selectMetadata || flags.resetValue) {
if (this.component.multiple && Array.isArray(this.dataValue)) {
this.dataValue.forEach(singleValue => this.setMetadata(singleValue));
this.dataValue.forEach(singleValue => this.setMetadata(singleValue, flags));
}
else {
this.setMetadata(this.dataValue);
this.setMetadata(this.dataValue, flags);
}
}
return changed;
Expand Down

0 comments on commit f60425a

Please sign in to comment.