title: NGXS computed selector
body: <p>I am trying to achieve a global &quot;New Messages&quot; counter whilst also tracking how many new messages are within each chat room. I am using a indexed object to track each room as simply a number of unread messages..</p>
  <pre><code>export interface ChatStateModel {
    unreadMessageCounterStore:{
          [roomId: number]: number
      }
  }
  </code></pre>
  <p>I was hoping to implement something like the below:</p>
  <pre><code>@Selector()
      public static GetCurrentUnreadMessageCount(state: ChatStateModel) {
          const counter = Object.values(state.unreadMessageCounterStore);
          const result = counter.reduce((accumulator, current) =&gt; {
              return accumulator + current;
          }, 0);
          return result;
      }
  </code></pre>
  <p>However the selector seems to not get &quot;triggered&quot; when changing a stored value - such as when a user visits the chat room I would like all unread messages in that room to be marked as read with the below action</p>
  <pre><code> @Action(MarkRoomAsRead)
      public markRoomAsRead({ setState }: StateContext&lt;ChatStateModel&gt;, { roomId }: MarkRoomAsRead) {
          setState(produce((draft) =&gt; {
             var roomCounter = draft.unreadMessageCounterStore[roomId];
             if (roomCounter){
              this.logger.log(`Removing unread messages from ${roomId}`);
              roomCounter = 0;
             }
          })
          );
      }
  </code></pre>
  <p>What am I missing to make NGXS trigger the change and push out to the subscribers of the selector? Is there a better approach?</p>
  <p>Thanks in advance</p>