Thanks to visit codestin.com
Credit goes to github.com

Skip to content

πŸ“š[DOCS]: Wrong or outdated "Optimizing Selectors" sectionΒ #2297

@Celebes

Description

@Celebes

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions