All observed selectors executes even if I don't change part of the state participating in these selectors.
I have state containing 3 properties: "a", "b", "c", one action for updating property "a", 3 static selectors for all properties. My component subscribes to "b" using async pipe and to "c" using subscribe method from observable. When i dispatch new action changing "a", then "b" and "c" selectors get executed.
Here is an example https://stackblitz.com/edit/ngxs-simple-1fte4j?file=app%2Fapp.component.ts
I expect none of the selectors get executed. Maybe I'm wrong and this is expected behavior, but it means that I can't put any expensive logic into the selector.
This is expected behaviour in earlier versions of NGXS (like the one used in your StackBlitz 3.1.4
) - selectors were always passed the containing state as the first parameter causing them to be re-evaluated on any state change.
Latest version as of now (3.5) provides Selector Options to change this - so check out that documentation.
Also see related PR and linked issues around selector options.