I have a BehaviorSubject<Array<user>> (userListSub$) state that is updated from various places.
For example,
- when I click Follow on a user
- when I click Unfollow on a user
- when I favorite a user
The same state is being subscribed in different components. I would like a particular component to not react to an event emitted by the state (userListSub$) if the event was triggered when I favorite the user.
I know we can store the origin of the event also in the state like this,
userListSub$.next({ data: user, origin: userList })
and check for the origin where I subscribe.
Is there a better way to identify or ignore the event on particular subscriptions?
Am I thinking in the right direction? If not, can you suggest a better way?