-
Notifications
You must be signed in to change notification settings - Fork 71
Description
Hi, I've an issue using renderFooterContent in a fab-panel. This is the template to reproduce the problem.
<fab-panel [isOpen]='true' headerText='Test' [renderFooterContent]='TEMPLATE'>
<render>
Content
<button (click)='IncCounter()'>Change</button>
</render>
</fab-panel>
<ng-template #TEMPLATE>
{{Counter}}
</ng-template>
I had this exception
ERROR TypeError: Cannot convert undefined or null to object
at Function.assign ()
at ReactTemplate.push../src/@angular-react/core/src/lib/renderer/react-template.ts.ReactTemplate.componentDidUpdate (react-template.ts:66)
at commitLifeCycles (react-dom.development.js:16242)
at commitAllLifeCycles (react-dom.development.js:17592)
at HTMLUnknownElement.callCallback (react-dom.development.js:149)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
at Object.onInvokeTask (core.js:17280)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:498)
I tried to patch the code of react-template in this way (obviously it's only a temporary workaround).
componentDidUpdate() {
// Context has changes, trigger change detection after pushing the new context in
try {
Object.assign(this._embeddedViewRef.context, this.props.context);
} catch {
console.info('ReactTemplate invalid context');
}
this._embeddedViewRef.detectChanges();
}
Naturally it seems to work, but when I click on the button the counter in the footer changes only if there is an event on the page (mouse move o click another time on the button).
It sounds like the componentDidUpdate method is called outsize the Angular Zone.
Another strange thing is that if I set the renderHeader with TEMPLATE, after rollback the workaround (try ... catch), it doesn't throw the previous exception but I've the same problem about the counter updating.
Thanks