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 assume <Tab /> components are available when setting the next index #2642

Merged
merged 2 commits into from
Aug 3, 2023

Conversation

RobinMalfait
Copy link
Member

Right now we assume that the Tab components are rendered when calculating the active index. But this isn't always the case if we are lazy loading the tab components.

If no tabs are available, then calculating the next index would result in -1 which is incorrect because then nothing is selected. Instead, we keep the currently selected index (typically 0) and once the tab gets loaded it will be the active one automatically.

Fixes: #2596
Fixes: #2640

Currently we were assuming that the `tabs` were always there, but this
@vercel
Copy link

vercel bot commented Aug 3, 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 3, 2023 9:59am
headlessui-vue ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 3, 2023 9:59am

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