Jan 14 · 1 min read

It doesn’t make sense that selector would be executed just once in this case.

We can simplify example and remove “id” property:

`this.counter2 = this.store.pipe(`

select(fromRoot.getCount(), { multiply: 2 })

);

this.counter4 = this.store.pipe(

select(fromRoot.getCount(), { multiply: 4 })

);

For every count change, selector function _must_ run twice to compute count for every `multiply` value. If it would run once, how it would know result for e.g. multiply: 4 ?

That’s not possible, regardless of ngrx version.

More interesting example would be if we’d had same props value:

`this.counter2 = this.store.pipe(`

select(fromRoot.getCount(), { multiply: 2 })

);

this.counter4 = this.store.pipe(

select(fromRoot.getCount(), { multiply: 2 })

);

There’s no point in executing selector twice, as result of computation will be same for both instances.

How ngrx will handle this?