Skip to content

Commit

Permalink
Make length a backwards compatible dependent key with dependentKeyCompat
Browse files Browse the repository at this point in the history
  • Loading branch information
richgt committed Feb 22, 2023
1 parent 8295458 commit 9d5f449
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/model/addon/-private/system/many-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import EmberArray from '@ember/array';
import MutableArray from '@ember/array/mutable';
import { assert } from '@ember/debug';
import EmberObject, { get } from '@ember/object';
import { dependentKeyCompat } from '@ember/object/compat'

import { all } from 'rsvp';

Expand Down Expand Up @@ -115,7 +116,7 @@ export default EmberObject.extend(MutableArray, DeprecatedEvented, {

/**
* Retrieve the links for this relationship
*
*
@property {Object | null} links
@public
*/
Expand Down Expand Up @@ -177,6 +178,7 @@ export default EmberObject.extend(MutableArray, DeprecatedEvented, {
}
},

@dependentKeyCompat
get length() {
if (this._isDirty) {
this.retrieveLatest();
Expand Down Expand Up @@ -314,7 +316,7 @@ export default EmberObject.extend(MutableArray, DeprecatedEvented, {
```javascript
let user = store.peekRecord('user', '1')
await login(user);
let permissions = await user.permissions;
await permissions.reload();
```
Expand Down

0 comments on commit 9d5f449

Please sign in to comment.