Skip to content

Check why we no longer bail out of subscription checks when store.getState() hasn't changed #2089

Open
@markerikson

Description

@markerikson

In v7, we definitely bailed out of useSelector if the store state hadn't changed:

const newStoreState = store.getState()
// Avoid calling selector multiple times if the store's state has not changed
if (newStoreState === latestStoreState.current) {
return
}

Per reduxjs/redux#4627 , there's questions of whether it still does that correctly in v8 with useSyncExternalStore. Should look into this.

(also, there's a question of whether we should bail out inside subscriber callbacks, or before calling them)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions