-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial state not passed to meta reducers during @ngrx/store/init #477
Comments
brandonroberts
added a commit
that referenced
this issue
Oct 14, 2017
MikeRyanDev
pushed a commit
that referenced
this issue
Oct 14, 2017
Awesome, thanks for the fix @brandonroberts ! Any idea when this will hit npm? cc @MikeRyanDev |
We are going to be releasing Entity in the next couple of days. Will probably publish everything else with it. |
Does 100a8ef also cover feature modules? I'm not sure if i'm doing something wrong, but the meta-reducer spec fails if you apply this patch diff --git a/modules/store/spec/modules.spec.ts b/modules/store/spec/modules.spec.ts
index 190c8b1..44feacb 100644
--- a/modules/store/spec/modules.spec.ts
+++ b/modules/store/spec/modules.spec.ts
@@ -129,7 +129,8 @@ describe(`Store Modules`, () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
- StoreModule.forRoot(reducerMap, { initialState, metaReducers }),
+ StoreModule.forRoot({}, { metaReducers: [] }),
+ StoreModule.forFeature("core", reducerMap, { initialState, metaReducers }),
],
});
@@ -138,7 +139,7 @@ describe(`Store Modules`, () => {
it('should have initial state', () => {
store.take(1).subscribe((s: any) => {
- expect(s).toEqual(initialState);
+ expect(s.core).toEqual(initialState);
});
});
};
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm submitting a...
What is the current behavior?
Initial state is not passed to meta reducers during @ngrx/store/init
Expected behavior:
Initial state should be passed to meta reducers during @ngrx/store/init, especially for libraries like ngrx-localstorage-sync which need to merge any supplied initial state with values saved in local storage, for example (see https://github.com/btroncone/ngrx-store-localstorage/blob/master/src/index.ts#L180).
Minimal reproduction of the problem with instructions:
https://stackblitz.com/edit/angular-c8kl8z
If you run the stackblitz, you'll see that state is undefined inside the logger metareducer during @ngrx/store/init (check the console, or debug if you want)
Version of affected browser(s),operating system(s), npm, node and ngrx:
Other information:
The text was updated successfully, but these errors were encountered: