FIX: ensures selection is lookedup into async content (#7586)

This commit is contained in:
Joffrey JAFFEUX 2019-05-22 17:11:19 +02:00 committed by GitHub
parent 631b16ef86
commit c238f0d223
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -198,12 +198,17 @@ export default SelectKitComponent.extend({
return this._super() && !this.get("hasReachedMaximum");
},
@computed("computedValues.[]", "computedContent.[]")
selection(computedValues, computedContent) {
@computed(
"computedValues.[]",
"computedContent.[]",
"computedAsyncContent.[]"
)
selection(computedValues, computedContent, computedAsyncContent) {
const selected = [];
const content = this.isAsync ? computedAsyncContent : computedContent;
computedValues.forEach(v => {
const value = computedContent.findBy("value", v);
const value = content.findBy("value", v);
if (value) selected.push(value);
});