ngx-formly: Universal SSR render error - Cannot read property 'hooks' of undefined
I’m submitting a … (check one with “x”)
[x ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request
Current behavior Visiting a page with a formly form rendered by Angular Universal SSR, I get an error, the page doesn’t load at all. The same page renders fine if rendered by browser.
TypeError: Cannot read property 'hooks' of undefined
at FormlyField.triggerHook (/home/test.universaledition.com/web/dist/server.js:171488:24)
at FormlyField.ngOnDestroy (/home/test.universaledition.com/web/dist/server.js:171432:14)
at callProviderLifecycles (/home/test.universaledition.com/web/dist/server.js:77721:18)
at callElementProvidersLifecycles (/home/test.universaledition.com/web/dist/server.js:77689:13)
at callLifecycleHooksChildrenFirst (/home/test.universaledition.com/web/dist/server.js:77679:29)
at destroyView (/home/test.universaledition.com/web/dist/server.js:85875:5)
at callViewAction (/home/test.universaledition.com/web/dist/server.js:86001:13)
at execEmbeddedViewsAction (/home/test.universaledition.com/web/dist/server.js:85944:17)
at destroyView (/home/test.universaledition.com/web/dist/server.js:85873:5)
at callViewAction (/home/test.universaledition.com/web/dist/server.js:86001:13)
Expected behavior Page should render with the form without any complications, no matter if it’s SSR or browser rendered.
Please tell us about your environment: using @nguniversal/express-engine for SSR (Node Express server) Latest version of ngx-formly (5.5.1) All libraries updated via npm update.
-
Angular version: 8.2.11
-
Browser: [all]
-
Language: [all]
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 22 (9 by maintainers)
Commits related to this issue
- fix(core): change the check File instance for SSR compatibility (#1865) fix #1864 — committed to ngx-formly/ngx-formly by aitboudad 5 years ago
- fix(core): ensure field is not empty when calling hooks (#2198) fix #1864 — committed to ngx-formly/ngx-formly by aitboudad 4 years ago
- fix(core): ensure field is not empty when calling hooks (#2198) fix #1864 — committed to ngx-formly/ngx-formly by aitboudad 4 years ago
@eng-dibo fixed in v5.6.0 release.
the above changes are located in your
server.ts
file which part of your source code and notnode_modules
use the following workarround until the new version is released.