miguelcobain / ember-paper

The Ember approach to Material Design.
http://miguelcobain.github.io/ember-paper
MIT License
889 stars 332 forks source link

Paper select errors when menu is closed on ember > 3.17 #1166

Closed LucasHill closed 2 years ago

LucasHill commented 4 years ago

When you open a <PaperSelect ... /> and then close the menu, you'll see this error show up in the console.

component.js:65 Uncaught (in promise) TypeError: Cannot read property 'appendChild' of null at PaperMenuContent.animateOut (component.js:65) at Object.destroyModifier (will-destroy.js:68) at CustomModifierState.destroy (index.js:6906) at StringDestroyableDestructor.[DID_DROP] (util.js:290) at util.js:201 at Set.forEach (<anonymous>) at didDestroyAssociated (util.js:200) at SimpleDestructor.[DID_DROP] (util.js:314) at util.js:201 at Set.forEach (<anonymous>)

The issue is from ember-power-select and you can see the relevant issues at: https://github.com/cibernox/ember-power-select/issues/1338 (fixed here) https://github.com/cibernox/ember-basic-dropdown/issues/540

The fix was released in ember-power-select 4.0.

I was able to verify the issues goes away by forcing ember-power-select to resolve to 4.0.4.

I see that ember-power-select requires ember 3.13 which is a year old, but this seems worth it as we would be totally blocked from upgrading without forcing the resolution.

hergaiety commented 4 years ago

Can confirm we're seeing this too trying to upgrade to Ember 3.17.x

        stack: >
            TypeError: Cannot read property 'appendChild' of null
                at PaperSelectEbdContent._callee$ (http://localhost:7357/assets/vendor.js:209457:33)
                at tryCatch (http://localhost:7357/assets/vendor.js:5014:40)
                at Generator.invoke [as _invoke] (http://localhost:7357/assets/vendor.js:5288:22)
                at Generator.prototype.<computed> [as next] (http://localhost:7357/assets/vendor.js:5047:21)
                at asyncGeneratorStep (http://localhost:7357/assets/vendor.js:209370:105)
                at _next (http://localhost:7357/assets/vendor.js:209372:196)
                at http://localhost:7357/assets/vendor.js:209372:366
                at new Promise (<anonymous>)
                at PaperSelectEbdContent.<anonymous> (http://localhost:7357/assets/vendor.js:209372:99)
                at PaperSelectEbdContent.animateOut (http://localhost:7357/assets/vendor.js:209483:30)
        message: >
            Cannot read property 'appendChild' of null

This traces back to ember-paper in the way described in LucasHill's original Issue report.

LucasHill commented 4 years ago

After I upgraded to 3.18 I started having the issue again. I realized it was addressed partially in the 1.0.0-beta33 release here: https://github.com/miguelcobain/ember-paper/blob/master/addon/components/paper-menu/content/component.js#L62

The problem is, in the test container the ember-basic-dropdown-wormhole does not exist. See: https://github.com/cibernox/ember-basic-dropdown/issues/411

So while beta 33 fixed the issue when I'm running the app, the error still exists when I'm running tests. Do we need to make a test specific condition for what element it selects?

hergaiety commented 4 years ago

1117 is related work and the broader initiative to bring this addon up to speed with 3.16.x