primeng icon indicating copy to clipboard operation
primeng copied to clipboard

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

Open fxvits opened this issue 8 years ago • 5 comments

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

fxvits avatar Jul 31 '18 13:07 fxvits

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)

vicentveg avatar Jul 31 '18 18:07 vicentveg

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)

leonardolessa avatar Aug 01 '18 18:08 leonardolessa

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

jslow421 avatar Aug 01 '18 19:08 jslow421

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

noamichael avatar Aug 02 '18 17:08 noamichael

Fixed already, yes. Try Rc1 please.

cagataycivici avatar Aug 06 '18 11:08 cagataycivici