Skip to content

Fix issue with Jest and legacy React apps using useTransition#2394

Merged
joshuaellis merged 6 commits into
pmndrs:nextfrom
dimitris-tsetsonis:next
Sep 18, 2025
Merged

Fix issue with Jest and legacy React apps using useTransition#2394
joshuaellis merged 6 commits into
pmndrs:nextfrom
dimitris-tsetsonis:next

Conversation

@dimitris-tsetsonis

@dimitris-tsetsonis dimitris-tsetsonis commented Sep 8, 2025

Copy link
Copy Markdown
Contributor

Why

Using latest react-spring version on a legacy React app (< 19.0.0) is throwing Error: Uncaught [TypeError: Cannot read properties of null (reading 'ref')] cause by this PR #2373

What

Patching the ref check so it doesn't try to assign the ref to the props object but passes the ref directly to the element.

Checklist

  • [ x ] Ready to be merged

@changeset-bot

changeset-bot Bot commented Sep 8, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d68bc40

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

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@vercel

vercel Bot commented Sep 8, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
react-spring Ready Ready Preview Sep 16, 2025 7:25am

@joshuaellis

Copy link
Copy Markdown
Member

Can you add a changeset please? also is there a way to test this change easily?

@dimitris-tsetsonis

dimitris-tsetsonis commented Sep 9, 2025

Copy link
Copy Markdown
Contributor Author

@joshuaellis I'll add the changeset today. I'll try to think if I can add a test but since it needs 2 different versions of React I don't think it's possible. I could add a demo with the failing code if you want.

@dimitris-tsetsonis

Copy link
Copy Markdown
Contributor Author

@joshuaellis I'm really keen to move this PR. Is there anything I need to do to help move the process?

@joshuaellis

Copy link
Copy Markdown
Member

I'll do an experimental release tomorrow, you can use it in a small demo w/ r18 to validate it works and share? StackBlitz would work?

@joshuaellis

Copy link
Copy Markdown
Member

I've just pushed a beta – https://www.npmjs.com/package/@react-spring/web/v/10.0.3-beta.0

thanks for the nudge 👍🏼

@dimitris-tsetsonis

Copy link
Copy Markdown
Contributor Author

I've just pushed a beta – https://www.npmjs.com/package/@react-spring/web/v/10.0.3-beta.0

thanks for the nudge 👍🏼

@joshuaellis thank you! Will try to push a demo on StackBlitz as soon as possible

@dimitris-tsetsonis

dimitris-tsetsonis commented Sep 16, 2025

Copy link
Copy Markdown
Contributor Author

@joshuaellis
Working demo with 10.0.3-beta.0 -> https://stackblitz.com/edit/vitejs-vite-3owlkm3h

Broken demo with 10.0.2 -> https://stackblitz.com/edit/vitejs-vite-f34k2mgy

Code is exactly the same only react spring version changing. Code is AI but I made sure it reproduces my issue

@dimitris-tsetsonis

Copy link
Copy Markdown
Contributor Author

@joshuaellis sorry to be a pain. I added the demos in my previous comment and also it was tested by @romain-trotard on his PR #2396 and he too found the solution here to be working.

We would love if you could review and move it for release!

@joshuaellis

Copy link
Copy Markdown
Member

Yep checked both your demos & even checked the working one on r19 and LGTM ✅

@joshuaellis
joshuaellis merged commit f69b748 into pmndrs:next Sep 18, 2025
14 checks passed
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.

3 participants