Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX lts] Ensure destroy methods on CoreObject are invoked. #19106

Merged
merged 1 commit into from
Aug 25, 2020

Commits on Aug 25, 2020

  1. [BUGFIX lts] Ensure destroy methods on CoreObject are invoked.

    When an instance of `CoreObject` is destroyed with `@ember/destroyable`
    (or the polyfill when using Ember 3.20+), the instances own `destroy`
    method is never called. In _general_ "this is fine" because the majority
    of consumers are using `willDestroy` for their custom object teardown
    needs. Unfortunately, this isn't _quite_ good enough and any consumers
    that are directly relying on extending from `CoreObject` and having a
    custom `destroy` method called will no longer function.
    
    The prime example of this is the `Owner` instance itself. Currently,
    running `destroy(owner)` **does not** actually destroy any instantiated
    objects in the container. This is because `ContainerProxyMixin`
    implements `destroy` in order to call `this.__container__.destroy()`
    which is where the actual cleanup happens. That whole system should be
    refactored to leveraging `@ember/destroyable` system directly, but in
    the meantime this case (and any others where folks have implemented a
    destroy method in Mixins or other subclasses of Ember.CoreObject) should
    **absolutely** be fixed.
    
    This fix ensures that any `destroy(someInstance)` calls on a
    `CoreObject` directly invoke the `destroy` method on the instance in the
    same manner as Ember < 3.20 (`.destroy()` is called eagerly, before
    `willDestroy`).
    rwjblue committed Aug 25, 2020
    Configuration menu
    Copy the full SHA
    4d55dae View commit details
    Browse the repository at this point in the history