[bug]: useTransition not working if called with dependency array

Open
#2,189 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
react, typescript
Domain
frontend

Research direction

Start with the linked CodeSandbox and the useTransition entry point, comparing behavior between react-spring 9.7.1 and 9.5.0 when a dependency array changes. Done means the web target animates the div after toggling with the dependency array, matching the documented behavior in 9.5.0.

Written by the indexing model from the issue text.

Description

area: core kind: bug
Which react-spring target are you using?
  • @react-spring/web
  • @react-spring/three
  • @react-spring/native
  • @react-spring/konva
  • @react-spring/zdog
What version of react-spring are you using?

9.7.1

What's Wrong?

useTransition springs are not starting if called with a dependency array in >=v9.5.0. It works as expected and documented <=v9.5.0.

To Reproduce

Open codesandbox
Click the toggle button (nothing happens)
Switch to v 9.5.0
Click toggle button again (a div is animating in)

Expected Behaviour

I expected useTransition to animate if the state in the dependency array changes.

Link to repo

https://codesandbox.io/s/loving-snyder-6llsgg

Dominant language
TypeScript
Stars
29.3k
Forks
1.2k
Avg merge
3d 15h
Merged PRs (30d)
17

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pmndrs/react-spring

All issues in pmndrs/react-spring

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.