I am experimenting using NGRX, however I cannot understand how to set selectors to only trigger updates when the relevant data has changed.
I am using a normalized store to keep track of a list of conversations. Each conversation has some details and a list of message ids. I then also have the list of messages in my store. Eventually I want to be able to show my list of conversation details in one component, and another component will take care of showing the actual messages.
However the selector which gives me the conversation details is being triggered even when I add a message - this will cause this component to refresh its data even though nothing has changed.
I have created a skeleton of my structure on Stackblitz to explain better what's happening.
Can someone please indicate what I'm doing wrong? It seems as though the immutability part of NGRX is causing a lot of overhead for me.
Thanks.
question from:
https://stackoverflow.com/questions/66068399/ngrx-immutability-of-objects-causing-multiple-selectors-to-trigger-changes 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…