pmndrs / pmndrs/react-spring

[bug]: When using useTranstion, the element corresponding to the initial value is not displayed.

Open
#1,928 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: core kind: bug
Dominant language
TypeScript
Stars
29.1k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

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.4.5

What's Wrong?

If an array or a function that returns an array is specified for the enter property of useTransition, elements that are drawn based on data passed as initial values in the first argument will complete drawing at the value specified in from.
(To be precise, they appear to animate from -> enter -> from.)

This problem is not reproduced when a single value, not an array, is specified for the enter property.
The problem does not occur in version 9.4.4, so the bug seems to be in 9.4.5.

To Reproduce

https://react-spring.dev/hooks/use-transition#multi-stage-transitions

Expected Behaviour

The element is displayed correctly for the initial value.

Link to repo

https://codesandbox.io/s/delicate-platform-vsik5n

Contributor guide

Open the contributing guide

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.

Research direction

Start with the useTransition multi-stage transitions example at https://react-spring.dev/hooks/use-transition#multi-stage-transitions and reproduce the behavior in the linked CodeSandbox. Compare @react-spring/web behavior between versions 9.4.4 and 9.4.5 for array or function-based enter values; done means initial elements render at the expected value without the from → enter → from sequence.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.