bugfix(initialState): invoke initialState if it's a function#272
bugfix(initialState): invoke initialState if it's a function#272alan-agius4 wants to merge 1 commit intongrx:masterfrom alan-agius4:patch-1
Conversation
|
Any update please? |
|
I do not think this would work with AoT. |
|
Why not? The whole problem here is that when the initialState is a function its never invoked. And since it is using useFactory its is expecting to be an invoked function I did this in some other private libraries and always worked likea charm woth AOT. In fact, we are hacking around this thing because ngrx has this bug. |
|
Could this be merge? I also have to add those 3 lines in my ng2.ts to make AOT work. And it does work very well but it would be nice to have it in a next release. |
|
Bump!!! |
|
I don't understand what is the problem with this. 3 lines of code to be able to pass a function to the initical state and thus make the lib work with AOT (which does not allow a call to a lambda function). Thus this: StoreModule.provideStore(rootReducer, LocalstorageService.loadState()),will not work, but this StoreModule.provideStore(rootReducer, LocalstorageService.loadState),works. And this simple method allows to load the state from localStorage which is quiet handy for a "state manager" library :) thanks |
|
@MikeRyanDev can we have some feedback please? It's been open since November! |
|
I think the update is that it can't be merge at all, the file does not exist anymore :) They are in the middle of a big refactor, there is no more StoreModule.provideStore but a StoreModule.forRoot or StoreModule.forFeature. I am using your solution in the meantime :) |
|
Still would make sense if they do it in the new implementation.
…On Mon, 03 Apr 2017 at 16:00, Sébastien Loix ***@***.***> wrote:
I think the update is that it can't be merge at all, the file does not
exist anymore :) They are in the middle of a big refactor, there is no more
StoreModule.provideStore but a StoreModule.forRoot or
StoreModule.forFeature.
I am using your solution in the meantime :)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#272 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AQv-WtiIrelkAmamZNDJPUhkvTTifREiks5rsPt7gaJpZM4K1cHz>
.
|
|
Yeah, they could have worked on the new version on another branch, leaving the master branch available for small updates like this one. But it's ok, I am sure the new version is going to take care of a lot of things including this. |
|
@alan-agius4 isn't this a duplicate of #217? |
|
Yes looks like it |

When initialState is not a function it's not being invoked
#273