[bug]: useState and api.start cause dom attributes not updated

Open
#2,187 7 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@Bilalshaikh15 is already working on this.

Since Aug 9, 2023.

Assessment

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

Research direction

Start with the linked CodeSandbox reproduction in src/App.tsx, using the @react-spring/web target and the interaction between useState and api.start. Run the example and trace why data-count differs while x is 0; done means the DOM attributes update consistently with the animated value.

Written by the indexing model from the issue text.

Description

area: web 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?

When api.start and useState are executed together, the property on the dom that judges x to be 0 is not updated

To Reproduce

Here is my minimal rendition @joshuaellis

link: https://codesandbox.io/s/awesome-joana-t28gsz?file=/src/App.tsx

You can see that data-count is not updated correctly but x is already 0

Expected Behaviour

attributes update

Link to repo

https://codesandbox.io/s/awesome-joana-t28gsz?file=/src/App.tsx

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.