Skip to content

useTransition causes rerender loop when array has fewer items #905

@BertCh

Description

@BertCh

🐛 Bug Report

Each re-render useTransition is passed an array from state. This works fine when adding objects, but when objects are removed from the array it triggers a rerender loop.
possibly related: #636

To Reproduce

Steps to reproduce the behavior:
press the buttons in the sandbox

Expected behavior

The animation seems to get run properly, but the rerender loop is unexpected.

Link to repro (highly encouraged)

bug with useState hook: https://codesandbox.io/s/usetransition-bug-state-v49uq

bug with useReducer hook (slightly more complex): https://codesandbox.io/s/usetransition-bug-25xbr

Environment

  • react-spring v8.x.x or 9.x beta
  • react v16.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions