React-spring: useTransition causes rerender loop when array has fewer items

Created on 17 Jan 2020  路  3Comments  路  Source: pmndrs/react-spring

馃悰 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
bug

All 3 comments

Please try with the latest canary.

Note: You'll need to update your useTransition calls. See #809.

woo it works!
Thanks for responding so quickly & for maintaining a good library 馃憤

The new useTransition api looks amazing - really looking forward to react-spring 9.

I found this issue after some maddening debugging, trying to figure out why my expired items were not unmounted. Do you think a quick note in your docs warning of this might be useful? EDIT - argghhh I just realized my problem was 100% a consequence of running in concurrent mode. Play on the bleeding edge, get cut :). /EDIT

Also, no pressure of course, but can I ask when you hope to have the current canary released? Very eager to get my hands on it. Thanks for all the hard work - truly appreciated

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cklab picture cklab  路  4Comments

fortezhuo picture fortezhuo  路  3Comments

sakhisheikh picture sakhisheikh  路  3Comments

anton-g picture anton-g  路  3Comments

mkhoussid picture mkhoussid  路  3Comments