Skip to content

Commit

Permalink
[BUGFIX] Matches assertion behavior for CPs computing after destroy
Browse files Browse the repository at this point in the history
Previously, there was an assertion that threw whenever a CP was
calculated after destroy, _and_ updated its dependent keys (i.e.
updated chains). This meant that CPs without any dependencies would
still run after destroy, and everything would work. The new assertion
always threw if anyone accessed _any_ CP. This changes it to only throw
if the CP has dependencies, matching the old behavior.
  • Loading branch information
Chris Garrett committed Jul 30, 2019
1 parent 49ea6fe commit 15b7910
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/@ember/-internals/metal/lib/computed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ export class ComputedProperty extends ComputedDescriptor {
if (EMBER_METAL_TRACKED_PROPERTIES) {
assert(
`Attempted to access the computed ${obj}.${keyName} on a destroyed object, which is not allowed`,
!metaFor(obj).isMetaDestroyed()
this._dependentKeys === undefined || !metaFor(obj).isMetaDestroyed()
);

// Create a tracker that absorbs any trackable actions inside the CP
Expand Down

0 comments on commit 15b7910

Please sign in to comment.