knownasilya/ember-plupload

Uncaught TypeError: Cannot read property 'appendChild' of null

bdmac opened this issue · 5 comments

bdmac commented

We are using the ember-plupload plugin and have noticed that when quickly switching between routes that have components rendering {{plupload}} we get an error originating in moxie.js L#2387.

It attempts to call container.appendChild(shimContainer) on that line and generates a "Uncaught TypeError: Cannot read property 'appendChild' of null" error.

My best guess is it has something to do with Ember component lifecycle events and the component (container?) being destroyed before plupload gets to this line.

Sounds about right.

bdmac commented

Is there a way to preempt this behavior to prevent the error on our side?

Ugh. Probably the solution is sprinkle in checks for if (this.isDestroyed) in the component hooks

Ugh. Probably correct. A PR is welcome