-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(store): prevent initializing state factory at feature levels (#2262
) In this commit, we mark the state factory as a root provider to prevent its initialization at feature levels when `provideStates` is called. Previously, the state factory was initialized at feature levels because it needed to retrieve the feature-level injector in order to call `injector.get(FeatureStateClass)`. This was necessary because, when `NgxsModule.forFeature([BlogState])` was called, the `BlogState` instance could only be retrieved from the feature injector hierarchy. Now, since `addAndReturnDefaults` is called at the feature level inside the feature environment initializer, it is executed within the feature injection context, allowing us to use the `inject(...)` function directly.
- Loading branch information
Showing
4 changed files
with
35 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters