I updated the project via ng update from [email protected] and [email protected] to the latest v13 minor releases ([email protected] / [email protected]).
Since the update I got following error in the web console:
table.component.ts:231 Uncaught TypeError: Cannot set property ɵfac of class BaseComponent {
constructor(injector) {
this.store = injector.get(_ngxs_store__...<omitted>...}
which has only a getter
at 7857 (table.component.ts:231:2)
at __webpack_require__ (bootstrap:19:1)
at 32552 (message.service.ts:18:31)
at __webpack_require__ (bootstrap:19:1)
at 21658 (auth.service.ts:6:21)
at __webpack_require__ (bootstrap:19:1)
at 197 (dialog.service.ts:31:32)
at __webpack_require__ (bootstrap:19:1)
at 47819 (route-not-found.component.html:13:5)
at __webpack_require__ (bootstrap:19:1)
at 98698 (menu-routing.module.ts:86:25)
at __webpack_require__ (bootstrap:19:1)
at 13785 (menu.module.ts:12:68)
at __webpack_require__ (bootstrap:19:1)
at 60796 (app.component.ts:30:26)
The component itself is an abstract BaseComponent used to be extended, the DI is managed by passing the Injector to the super constructor.
I already researched and came across Angular 9 production error: Cannot set property ɵfac of (abstract) class MyFilter { } which has only a getter
Removing the @Component Tag removes the error but why shouldn't it work anymore? Furthermore after removing the tag another error appears in the console (I'm using [email protected] and note that the NGX-Store worked before, no code change in between)
core.mjs:6494 ERROR Error: You have forgotten to import the NGXS module!
at throwSelectFactoryNotConnectedError (ngxs-store.js:73:1) [angular]
at createSelectObservableIvy (ngxs-store.js:3844:1) [angular]
at createSelectObservable (ngxs-store.js:3800:1) [angular]
at dev/vendor.js:86124:36 [angular]
at doInnerSub (mergeInternals.js:19:18) [angular]
at outerNext (mergeInternals.js:14:1) [angular]
at OperatorSubscriber._next (OperatorSubscriber.js:13:1) [angular]
at OperatorSubscriber.next (Subscriber.js:31:1) [angular]
at ReplaySubject._subscribe (ReplaySubject.js:31:1) [angular]
at ReplaySubject._trySubscribe (Observable.js:37:1) [angular]
at ReplaySubject._trySubscribe (Subject.js:74:1) [angular]
at dev/vendor.js:98953:30 [angular]
at errorContext (errorContext.js:19:1) [angular]
at ReplaySubject.subscribe (Observable.js:22:21) [angular]
Anyone got an idea? I'm stuck on this. Thank you!
I found a solution:
the @Select Tags from the ngxs/store seem to be conflicting. When replacing them with select functions from the store the BaseComponents work fine!