-
-
Notifications
You must be signed in to change notification settings - Fork 7
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
The read of selectedState here can end up tracked in a reactive context like an effect, if a dispatch is made inside of that context. This happens because a dispatch causes subscribers to run synchronously to receive the newly reduced state, and selectedState is read inside a subscriber.
There are 2 possible fixes here:
-
For good reactive hygiene, ideally the whole
dispatch()operation should be untracked. Nothing downstream ofdispatch()makes sense to track if invoked from a reactive context. -
In addition to 1,
linkedSignalsupports equality directly so the read ofselectedStatein order to invoke the equality function is actually not necessary. Instead, the equality operation can be delegated tolinkedSignal.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working