fix(store): stop connecting the @Select decorator automatically - #2510
Merged
Conversation
`SelectFactory` writes the request's `Store` into a module-level static so the `@Select` getter can reach it without DI. On the server that static outlives the request, retaining the whole state graph for the life of the process. `rootStoreInitializer()` forced `SelectFactory` to exist on every `provideStore()` / `NgxsModule.forRoot()`, whether or not `@Select` was used. It is now opt-in, so apps that do not use `@Select` (the deprecated path) no longer pay for it. BREAKING CHANGES: Apps using the deprecated `@Select` decorator must now connect it explicitly, otherwise accessing a `@Select` property throws. Standalone: ```ts provideStore([CountriesState], withNgxsSelectDecoratorSupport()); ``` NgModule: ```ts @NgModule({ imports: [ NgxsModule.forRoot([CountriesState]), NgxsSelectDecoratorSupportModule.forRoot() ] }) export class AppModule {} ``` Prefer migrating to `store.select()`, the functional `select()`, or `store.selectSignal()`: https://ngxs.io/deprecations/select-decorator-deprecation
arturovt
requested review from
Carniatto,
joaqcid,
kuncevic,
markwhitfeld,
poloagustin and
splincode
as code owners
September 2, 2026 15:38
BundleMonUnchanged files (6)
No change in files bundle size Unchanged groups (1)
Final result: ❌ View report in BundleMon website ➡️ |
BundleMon (NGXS Plugins)Unchanged files (9)
No change in files bundle size Unchanged groups (1)
Final result: ✅ View report in BundleMon website ➡️ |
BundleMon (Integration Projects)Unchanged files (1)
No change in files bundle size Final result: ✅ View report in BundleMon website ➡️ |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SelectFactorywrites the request'sStoreinto a module-level static so the@Selectgetter can reach it without DI. On the server that static outlives therequest, retaining the whole state graph for the life of the process.
rootStoreInitializer()forcedSelectFactoryto exist on everyprovideStore()/NgxsModule.forRoot(), whether or not@Selectwas used.It is now opt-in, so apps that do not use
@Select(the deprecated path) nolonger pay for it.
BREAKING CHANGES:
Apps using the deprecated
@Selectdecorator must now connect it explicitly,otherwise accessing a
@Selectproperty throws.Standalone:
NgModule:
Prefer migrating to
store.select(), the functionalselect(), orstore.selectSignal():https://ngxs.io/deprecations/select-decorator-deprecation