[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

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

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

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.