Skip to content

Commit

Permalink
fix(store): ensure features are initialized after root state (#2083)
Browse files Browse the repository at this point in the history
We have a check that ensures states are initialized in the correct order and
that the `UpdateState` action shouldn't be dispatched before the `InitState` action.
This code updates the order of environment providers to place features at the end.
As a result, the root environment initializer runs earlier, dispatching the `InitState` action.
  • Loading branch information
arturovt authored Dec 18, 2023
1 parent 59b0c4a commit 414599c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ $ npm install @ngxs/store@dev

### To become next patch version

- Feat: schematics support a project option and standalone detection [#2089](https://github.com/ngxs/store/pull/2089)
- Feat: Schematics support a project option and standalone detection [#2089](https://github.com/ngxs/store/pull/2089)
- Fix: Ensure features are initialized after root state [#2083](https://github.com/ngxs/store/pull/2083)
- Fix: Log feature states added before store is initialized [#2067](https://github.com/ngxs/store/pull/2067)
- Fix: Show error when state initialization order is invalid [#2066](https://github.com/ngxs/store/pull/2066), [#2067](https://github.com/ngxs/store/pull/2067)
- Fix: Router Plugin - Expose `NGXS_ROUTER_PLUGIN_OPTIONS` privately [#2037](https://github.com/ngxs/store/pull/2037)
Expand Down
4 changes: 2 additions & 2 deletions packages/store/src/standalone-features/provide-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ export function provideStore(

return makeEnvironmentProviders([
...getRootProviders(states, options),
features,
NGXS_ROOT_ENVIRONMENT_INITIALIZER
NGXS_ROOT_ENVIRONMENT_INITIALIZER,
features
]);
}

Expand Down

0 comments on commit 414599c

Please sign in to comment.