Skip to content

[bug]: Tab crash with skipAnimation and loop #2409

@lPadier

Description

@lPadier

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?

10.0.3

What's Wrong?

When combining a SpringValue that has loop: true and Globals.assign({skipAnimation:true}), there is an infinite loop that crashes the tab.

When setting immediate: true, this infinite loop runs every frame (with the request animation frame loop).

To Reproduce

This minimal code is enough to lock the main thread at 100% usage.

import { Globals, SpringValue } from "@react-spring/web";

Globals.assign({ skipAnimation: true });

new SpringValue(0, {
  to: 1,
  loop: true,
});

Expected Behaviour

If we are setting skipAnimation or immediate, I think the loop parameter should be ignored to avoid this infinite loop.

Link to repo

https://codesandbox.io/p/sandbox/tender-scott-5k6l8w

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions