Skip to content
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

fix(Store): bootstrap store with partial initial state #1163

Merged
merged 9 commits into from
Jul 13, 2018

Conversation

timdeschryver
Copy link
Member

This changes the way features are added and removed.
Instead of adding/removing feature by feature, this adds/removes them in all together in batch.

With consequence that will only dispatch @ngrx/store/update-reducers once, if this isn't what we want we can still dispatch every feature one by one.

The "original" addFeature, removeFeature, addReducer, removeReducer methods will loop through the corresponding addFeatures, removeFeatures, addReducers, removeReducers methods.

Will it be beneficial to also add addReducers and removeReducers in store.ts?

This closes #906 and closes #909

@@ -1,117 +1,117 @@
import {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what happened here? 😅

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert these changes

@coveralls
Copy link

coveralls commented Jun 30, 2018

Coverage Status

Coverage increased (+0.09%) to 88.25% when pulling 126195d on tdeschryver:features-in-batch into e7de882 on ngrx:master.

@@ -1,117 +1,117 @@
import {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert these changes

private updateReducers(keys: string[]) {
this.next(this.reducerFactory(this.reducers, this.initialState));

if (keys.length === 1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be a breaking change. Currently there is one dispatch per reducer update.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be sure, we want to keep dispatching every update?

Copy link
Member

@brandonroberts brandonroberts Jul 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, dispatch individual updates for each key added. In V7, we'll change it to dispatch one action with an array of the added keys.

@brandonroberts
Copy link
Member

Don't know what's going on with the whitespace changes. Update the commit message also

@timdeschryver timdeschryver changed the title Features in batch fix(Store): bootstrap store with partial initial state Jul 7, 2018
@brandonroberts brandonroberts merged commit 11bd465 into ngrx:master Jul 13, 2018
timdeschryver added a commit to timdeschryver/platform that referenced this pull request Jul 15, 2018
@timdeschryver timdeschryver deleted the features-in-batch branch August 11, 2018 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Store: Handling of @ngrx/store/update-reducers Action on Startup leads to strange behaviour for initialStates
3 participants