Primeng: OverlayPanel issue. Error is raised when ngOnDestroy is called and this.container is undefined

Created on 31 Jul 2018  路  5Comments  路  Source: primefaces/primeng

I'm submitting a

[x] bug report

Current behavior
OverlayPanel raised an error on ngOnDestroy method call if this.container object is undefined. The restoreAppend method should be

OverlayPanel.prototype.restoreAppend = function () {
if (this.appendTo && this.container) {
this.el.nativeElement.appendChild(this.container);
}
};

Expected behavior
No Error.

Angular version: 6.1.0
PrimeNG version: 6.0.2
Browser: all

Most helpful comment

I think I have the same problem, the life was easiers before the update...
The complete error is:

ERROR Error: Uncaught (in promise): TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
    at OverlayPanel.push../node_modules/primeng/components/overlaypanel/overlaypanel.js.OverlayPanel.restoreAppend (overlaypanel.js:74)
    at OverlayPanel.push../node_modules/primeng/components/overlaypanel/overlaypanel.js.OverlayPanel.ngOnDestroy (overlaypanel.js:124)
    at callProviderLifecycles (core.js:9574)
    at callElementProvidersLifecycles (core.js:9542)
    at callLifecycleHooksChildrenFirst (core.js:9532)
    at destroyView (core.js:10594)
    at callViewAction (core.js:10720)
    at execComponentViewsAction (core.js:10642)
    at destroyView (core.js:10593)
    at callViewAction (core.js:10720)
    at OverlayPanel.push../node_modules/primeng/components/overlaypanel/overlaypanel.js.OverlayPanel.restoreAppend (overlaypanel.js:74)
    at OverlayPanel.push../node_modules/primeng/components/overlaypanel/overlaypanel.js.OverlayPanel.ngOnDestroy (overlaypanel.js:124)
    at callProviderLifecycles (core.js:9574)
    at callElementProvidersLifecycles (core.js:9542)
    at callLifecycleHooksChildrenFirst (core.js:9532)
    at destroyView (core.js:10594)
    at callViewAction (core.js:10720)
    at execComponentViewsAction (core.js:10642)
    at destroyView (core.js:10593)
    at callViewAction (core.js:10720)
    at resolvePromise (zone.js:814)
    at resolvePromise (zone.js:771)
    at zone.js:873
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
    at Object.onInvokeTask (core.js:3816)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
    at drainMicroTaskQueue (zone.js:595)
    at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:500)
    at invokeTask (zone.js:1540)

All 5 comments

I think I have the same problem, the life was easiers before the update...
The complete error is:

ERROR Error: Uncaught (in promise): TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
    at OverlayPanel.push../node_modules/primeng/components/overlaypanel/overlaypanel.js.OverlayPanel.restoreAppend (overlaypanel.js:74)
    at OverlayPanel.push../node_modules/primeng/components/overlaypanel/overlaypanel.js.OverlayPanel.ngOnDestroy (overlaypanel.js:124)
    at callProviderLifecycles (core.js:9574)
    at callElementProvidersLifecycles (core.js:9542)
    at callLifecycleHooksChildrenFirst (core.js:9532)
    at destroyView (core.js:10594)
    at callViewAction (core.js:10720)
    at execComponentViewsAction (core.js:10642)
    at destroyView (core.js:10593)
    at callViewAction (core.js:10720)
    at OverlayPanel.push../node_modules/primeng/components/overlaypanel/overlaypanel.js.OverlayPanel.restoreAppend (overlaypanel.js:74)
    at OverlayPanel.push../node_modules/primeng/components/overlaypanel/overlaypanel.js.OverlayPanel.ngOnDestroy (overlaypanel.js:124)
    at callProviderLifecycles (core.js:9574)
    at callElementProvidersLifecycles (core.js:9542)
    at callLifecycleHooksChildrenFirst (core.js:9532)
    at destroyView (core.js:10594)
    at callViewAction (core.js:10720)
    at execComponentViewsAction (core.js:10642)
    at destroyView (core.js:10593)
    at callViewAction (core.js:10720)
    at resolvePromise (zone.js:814)
    at resolvePromise (zone.js:771)
    at zone.js:873
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
    at Object.onInvokeTask (core.js:3816)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
    at drainMicroTaskQueue (zone.js:595)
    at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:500)
    at invokeTask (zone.js:1540)

I have the same issue when I navigate to another view but apparently it is happening on dialog.

Angular: 6.0.3
Primeng: 6.0.2

ERROR Error: Uncaught (in promise): TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
    at Dialog.restoreAppend (dialog.js?4347:373)
    at Dialog.ngOnDestroy (dialog.js?4347:402)
    at callProviderLifecycles (core.js?5c38:9365)
    at callElementProvidersLifecycles (core.js?5c38:9333)
    at callLifecycleHooksChildrenFirst (core.js?5c38:9323)
    at destroyView (core.js?5c38:10385)
    at callViewAction (core.js?5c38:10511)
    at execEmbeddedViewsAction (core.js?5c38:10454)
    at destroyView (core.js?5c38:10383)
    at callViewAction (core.js?5c38:10511)
    at Dialog.restoreAppend (dialog.js?4347:373)
    at Dialog.ngOnDestroy (dialog.js?4347:402)
    at callProviderLifecycles (core.js?5c38:9365)
    at callElementProvidersLifecycles (core.js?5c38:9333)
    at callLifecycleHooksChildrenFirst (core.js?5c38:9323)
    at destroyView (core.js?5c38:10385)
    at callViewAction (core.js?5c38:10511)
    at execEmbeddedViewsAction (core.js?5c38:10454)
    at destroyView (core.js?5c38:10383)
    at callViewAction (core.js?5c38:10511)
    at resolvePromise (zone.js?011b:814)
    at resolvePromise (zone.js?011b:771)
    at eval (zone.js?011b:873)
    at ZoneDelegate.invokeTask (zone.js?011b:421)
    at Object.onInvokeTask (core.js?5c38:3748)
    at ZoneDelegate.invokeTask (zone.js?011b:420)
    at Zone.runTask (zone.js?011b:188)
    at drainMicroTaskQueue (zone.js?011b:595)
    at ZoneTask.invokeTask [as invoke] (zone.js?011b:500)
    at invokeTask (zone.js?011b:1540)

Can confirm seeing same error. Change suggested by @fxvits appears to be working without an issue.

This was fixed in 6.1.0-rc.1. See #6168

Fixed already, yes. Try Rc1 please.

Was this page helpful?
0 / 5 - 0 ratings