Skip to content
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

Don't overwrite user-defined template refs when rendering #2720

Merged
merged 2 commits into from
Aug 30, 2023

Conversation

thecrypticace
Copy link
Contributor

In some cases if we used our own ref (we do this in <TransitionRoot> for instance) and rendered slot children we would wipe out user-specified refs. This could be easily reproduced when adding a ref on a component that was an immediate child of a <TransitionRoot> with as="template".

So, now, we set a flag when calling cloneVNode to merge our refs and any user-specified refs thus preserving own own refs and any user-specified template refs.

Fixes #2710

In some cases if we used our own ref (we do this in `<TransitionRoot>` for instance) and rendered slot children we would wipe out  user-specified refs. So we set a flag when calling `cloneVNode` to merge our refs and any user-specified refs.
@thecrypticace thecrypticace changed the title Don't overwrite user-defined refs when rendering Don't overwrite user-defined template refs when rendering Aug 30, 2023
@vercel
Copy link

vercel bot commented Aug 30, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
headlessui-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 30, 2023 4:53pm
headlessui-vue ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 30, 2023 4:53pm

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.

<Dialog />'s ref is always undefined
1 participant