Skip to content

fix(core): auto-start useTransition when props is a function (#2287)#2532

Merged
joshuaellis merged 1 commit into
nextfrom
fix/2287-transition-autostart
Jun 9, 2026
Merged

fix(core): auto-start useTransition when props is a function (#2287)#2532
joshuaellis merged 1 commit into
nextfrom
fix/2287-transition-autostart

Conversation

@joshuaellis

Copy link
Copy Markdown
Member

Summary

The documented function form of useTransitionuseTransition(data, () => ({ from, enter, leave })) — never ran its enter animation on mount, while the config-object form did. The function/deps form creates an internal SpringRef, and that ref was being treated as if a ref had been injected, deferring the animation until an imperative api.start() that the documented usage never makes. The deferral is now scoped to genuinely injected refs (config.ref), so the function form animates on mount while useChain orchestration and StrictMode remounts keep working.

If you previously worked around this by calling api.start() manually on the function form, the transition now also auto-starts on mount.

Related issues

@changeset-bot

changeset-bot Bot commented Jun 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c7013b6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@react-spring/core Patch
@react-spring/animated Patch
@react-spring/mock-raf Patch
@react-spring/parallax Patch
@react-spring/rafz Patch
@react-spring/shared Patch
@react-spring/types Patch
@react-spring/konva Patch
@react-spring/native Patch
@react-spring/three Patch
@react-spring/web Patch
@react-spring/zdog Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@joshuaellis joshuaellis merged commit 4eed726 into next Jun 9, 2026
21 checks passed
@joshuaellis joshuaellis deleted the fix/2287-transition-autostart branch June 9, 2026 13:16
@github-actions github-actions Bot mentioned this pull request Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug]: useTransition with a function not working

1 participant