Skip to content

Commit

Permalink
fix: entangle [] tag for ember-source 3.20
Browse files Browse the repository at this point in the history
  • Loading branch information
runspired committed May 12, 2021
1 parent 3291671 commit 0914e86
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/model/addon/-private/system/promise-many-array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ export default class PromiseManyArray {
return this.content ? this.content.length : 0;
}

// ember-source < 3.23 (e.g. 3.20 lts)
// requires that the tag `'[]'` be notified
// on the ArrayProxy in order for `{{#each}}`
// to recompute. We entangle the '[]' tag from
@dependentKeyCompat
get '[]'() {
return this.content ? this.content['[]'] : this.content;
}

/**
* Iterate the proxied content. Called by the glimmer iterator in #each
*
Expand All @@ -66,7 +75,8 @@ export default class PromiseManyArray {
* @private
*/
forEach(cb) {
if (this.content) {
this['[]']; // needed for < 3.23 support e.g. 3.20 lts
if (this.content && this.length) {
this.content.forEach(cb);
}
}
Expand Down

0 comments on commit 0914e86

Please sign in to comment.