Skip to content

useSelector returns new value on each call even equalityFn returns true #1654

Closed
@otakustay

Description

@otakustay

What is the current behavior?

  1. Open https://codesandbox.io/s/serene-franklin-pjkhu?file=/src/App.js
  2. Press button
  3. Inspect console log

We have some confusing logs in console like:

array equals: true 
selector value changed 

This indicates the return value of useSelector changes even its equalityFn returns true.

What is the expected behavior?

In DisplayValueList component, the value mustChange can change on every press, but the next useSelector should return a constant value because its selector function returns a static array and its equalityFn is set to an array equal function, the console log should be clean.

When the first useSelector is removed, the console output is clean as expected, this is even more confusing to me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions