Skip to content

fix: Check if adding to registry in useInsertionEffect fails and fall back to useLayoutEffect #857

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 30, 2025

Conversation

JeremyRH
Copy link
Contributor

@JeremyRH JeremyRH commented Apr 28, 2025

Addresses #856.

This will call both useInsertionEffect and useLayoutEffect and a ref is used to return early in useLayoutEffect if useInsertionEffect worked.

I tried to add tests but it seems like a fairly complete DOM implementation is needed. I didn't feel comfortable adding jsdom or happy-dom.

@JeremyRH JeremyRH requested a review from ijjk as a code owner April 28, 2025 14:40
@JeremyRH JeremyRH changed the title Check if adding to registry in useInsertionEffect fails and fall back to useLayoutEffect fix: Check if adding to registry in useInsertionEffect fails and fall back to useLayoutEffect Apr 28, 2025
@ijjk ijjk requested a review from huozhi April 28, 2025 17:55
@JeremyRH JeremyRH force-pushed the fix-useInsertionEffect-no-doc-head branch from 537928d to 9c803ea Compare April 29, 2025 21:10
Copy link
Member

@huozhi huozhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! thanks. CI is failing, going to address it here #858

@huozhi huozhi merged commit d7a5937 into vercel:main Apr 30, 2025
4 checks passed
Copy link

🎉 This PR is included in version 5.1.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants