[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => https://github.com/ngxs/store/blob/master/CONTRIBUTING.md
[ ] Other... Please describe:
Doesn't work when using AOT.
As soon as @ngxs/storage-plugin tries to intercept the state it throws:
ERROR TypeError: Cannot read property 'split' of null
at getValue (ngxs-store.js:602)
at TapSubscriber._tapNext (ngxs-storage-plugin.js:115)
at TapSubscriber.push.../../node_modules/rxjs/_esm5/internal/operators/tap.js.TapSubscriber._next (tap.js:45)
at TapSubscriber.push.../../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next (Subscriber.js:53)
at TapSubscriber.push.../../node_modules/rxjs/_esm5/internal/operators/tap.js.TapSubscriber._next (tap.js:51)
at TapSubscriber.push.../../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next (Subscriber.js:53)
at ReplaySubject.push.../../node_modules/rxjs/_esm5/internal/ReplaySubject.js.ReplaySubject._subscribe (ReplaySubject.js:67)
at ReplaySubject.push.../../node_modules/rxjs/_esm5/internal/Observable.js.Observable._trySubscribe (Observable.js:43)
at ReplaySubject.push.../../node_modules/rxjs/_esm5/internal/Subject.js.Subject._trySubscribe (Subject.js:89)
at ReplaySubject.push.../../node_modules/rxjs/_esm5/internal/Observable.js.Observable.subscribe (Observable.js:29)
To work when using AOT.
AOT is an important feature of the Angular CLI.
Libs:
- @angular/core version: 8.0.0
- @ngxs/store version: 3.3.2
For Tooling issues:
- Node version: v12.1.0
- Platform: Windows
TL;DR
NGXS just doesn't work overall with AOT enabled.
Very strange, my projects are all written NGXS with storage plugin and use AOT
Show me repo example
@marcus-sa
Make a reproduction please, we all use this plugin in production and haven't met this before.
@marcus-sa Are you by any chance using Storage Plugin + Universal? I had a related issue then but I couldn't debug it. Just using Storage Plugin + AOT works fine for me
@internalsystemerror
@Dav1dde had a chance to fix that issue caused by combo storage + universal :tada:
Will be released in 3.5.0
My project is compiled with AOT and everything is working fine. Using the storage plugin too.
A github repo would definitely be helpful here (stackblitz cannot do AOT).
Another issue without steps to reproduce... the NGXS team should start rejecting these issues. You cannot expect the contributors to resolve an issue they are unable to debug.
@andrewjrhill
True. I'll wait 4 more days so it will be a week. Then I'm gonna close it if it stays w/o repro.
Closing this due to inactivity.
I don't want to accumulate a large amount of issues, there are too many issues without reproduction and we're not able to fix it just because we cannot determine what's going wrong.
I will reopen this issue immediately when we get a reproduction.
@andrewjrhill thanks for the good idea!
This works without AOT, but fails with it:
@NgModule({
declarations: [AppComponent],
imports: [
NgxsStoragePluginModule.forRoot({
deserialize(data) {
// Do deserialization
},
}),
...
This works with/without AOT:
export function deserialize(data: any) {
// Do deserialization
}
@NgModule({
declarations: [AppComponent],
imports: [
NgxsStoragePluginModule.forRoot({
deserialize,
}),
...
I would suggest to update the docs, to provide info on this behavior somehow.
@kemenesbalazs would you want to make a PR?
Most helpful comment
@andrewjrhill
True. I'll wait 4 more days so it will be a week. Then I'm gonna close it if it stays w/o repro.