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

📚[DOCS]: Wrong or outdated "Optimizing Selectors" section #2297

Open
Celebes opened this issue Jan 27, 2025 · 0 comments
Open

📚[DOCS]: Wrong or outdated "Optimizing Selectors" section #2297

Celebes opened this issue Jan 27, 2025 · 0 comments

Comments

@Celebes
Copy link

Celebes commented Jan 27, 2025

Description

https://www.ngxs.io/concepts/select/optimizing-selectors

I think the description here is wrong/outdated and contradicts itself?

One way to solve this problem is to turn off the injectContainerState selector option at root, state, or selector level. By default (in NGXS v3), the state is implicitly injected as the first argument for composite selectors defined within state classes. Turning off this setting prevents the container state from being injected as the first argument. This requires you to explicitly specify all arguments when you use the @selector([...]) decorator. Any parameterless @selector() decorators will still inject the state as an implicit argument. Note that this option does not apply to selectors declared outside of state classes (because there is no container state to inject).

From what I understand based on https://www.ngxs.io/concepts/store/options and https://www.ngxs.io/concepts/store/options:

  • injectContainerState is false by default now so there's no reason to write about turning it off (the description implies that it is set to true and you have to set it off)
  • ...because of that, the state is no longer implicitly injected as the first argument for composite selectors defined within state classes by default
  • we are now by default required to explicitly specify all arguments when we use the @selector([...]) decorator
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

No branches or pull requests

1 participant