https://stackblitz.com/edit/ngrx-seed-vnhhsk?file=src%2Fapp%2Freducers%2Findex.ts
Setup:
Steps to reproduce:
1 Click on the + button to increase the counter. This will be quick and not trigger the getEntity selector
2 Click on the "Update 2" button. This will update the entity with id 2 and the selector function will be executed.
3 Click on the + button again. This time it will not be quick since the getEntity selector was triggered again. However, it shouldn't have because the entity object was not updated.
When clicking on the + button in step 3, the created getEntity selector should not be called since the entity object has not been changed.
6.1.0
I think the error is caused by the memoize function here: https://github.com/ngrx/platform/blob/master/modules/store/src/selector.ts#L62. If the arguments were changed but not the result, the lastArguments will never be reassigned. This means that the selector will be called the next time the memoize function is called since it thinks that the arguments has been changed. This can be prevented by adding the following line
lastArguments = arguments;
in the if(isResultEqual...
[x ] Yes (Assistance is provided if you need help submitting a pull request)
[ ] No
Same behaviour here. All our selectors are created via createSelectorFactory with a custom memoization function to bypass the result check. But sometime the defaultMemoize is called anyway.
Sorry I didn't notice you came to the same conclusion as I did, after I created the PR 馃槄 .
But it rang a bell from a previous commit so I went ahead and created the PR.
Most helpful comment
Sorry I didn't notice you came to the same conclusion as I did, after I created the PR 馃槄 .
But it rang a bell from a previous commit so I went ahead and created the PR.