kybishop / ember-popper

Popper.js for Ember
MIT License
39 stars 35 forks source link

Only destroy the Popper instance if it has been created #121

Closed fusion2004 closed 4 years ago

fusion2004 commented 4 years ago

With ember-ref-modifier v1, the ref modifier operates asynchronously, so our test suite started erroring with calling destroy() on undefined because the willDestroyElement lifecycle hook makes the assumption that the Popper instance got created synchronously when the component was rendered.

I'm assuming our test suite was rendering and destroying Popper instances quickly enough in some cases where the ref modifier hadn't yet registered the popper element.

I added a similar check to what is called within the _updatePopper() method to make sure the popper instance exists before attempting to destroy it.

simonihmig commented 4 years ago

Published as v0.11.1!