Skip to content

Untrack all dispatch operations #18

Closed
@alxhub

Description

@alxhub

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:

  1. For good reactive hygiene, ideally the wholedispatch() operation should be untracked. Nothing downstream of dispatch() makes sense to track if invoked from a reactive context.

  2. In addition to 1, linkedSignal supports equality directly so the read of selectedState in order to invoke the equality function is actually not necessary. Instead, the equality operation can be delegated to linkedSignal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions