So my case is very similar to Slack chats.
I have a domain store with chats and when I open some chat with unread messages I'd like to have some separator between read and unread (new) messages.
Also at the moment I open a chat I send a request to mark all unread messages of this chat as read.
So my problem is: after getting a response from the server all my messages become read in my domain store. But in my messages component they should still be displayed as unread (below the "new messages separator") until user performs some specific actions.
So if it was just React I could use shouldComponentUpdate
to just ignore changing of isUnread
prop.
Previously I had local observable copy of messages in this component which I just initialized in constructor and then updated in componentWillReceiveProps
(ignoring mentioned prop changes). Now this lifecycle is deprecated and all this approach seems like an anti-pattern anyway. Even MobX says not to copy observables in such way.
Same thing about reactions. They should be used for side effects and not for copying observed data to another observables.
Thus I can't figure out any correct approach for this.