Skip to content

Bug: Emit same object will not trigger re-render #91

@csr632

Description

@csr632

live demo: https://codesandbox.io/s/rxjs-hooks-bug-zuvek?fontsize=14

Only newer version of react(with setState bail out feature) have this bug. I use 16.10.2


I think the bug is caused by this line:

setState(value)

If my observable emit same mutable object again and again, the subscriber component will not re-render.
Because setState will bail out of updates if the next value is the same as the previous one

If the same mutable object contain different data among renders, we will not see the latest data.

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