Tabs content not rendered in SSR context
See original GitHub issueWhat package within Headless UI are you using?
What version of that package are you using?
1.4.3
What browser are you using?
Chrome
Reproduction URL
https://github.com/sylvaingi/headless-ui-tabs-ssr-issue
Describe your issue
When using the Tab compoents in a SSR context (Next 12), the contents of the selected tab are not rendered.
For example the following code
<Tab.Group>
<Tab.List>
<Tab>Tab 1</Tab>
<Tab>Tab 2</Tab>
</Tab.List>
<Tab.Panels className="TAB_CONTENTS_HERE">
<Tab.Panel>Contents of tab 1</Tab.Panel>
<Tab.Panel>Contents of tab 2</Tab.Panel>
</Tab.Panels>
</Tab.Group>
will yield the following HTML:
<div role="tablist" aria-orientation="horizontal">
<button
id="headlessui-tabs-tab-undefined"
role="tab"
type="button"
aria-selected="false"
tabindex="-1"
>
Tab 1</button
><button
id="headlessui-tabs-tab-undefined"
role="tab"
type="button"
aria-selected="false"
tabindex="-1"
>
Tab 2
</button>
</div>
<div class="TAB_CONTENTS_HERE"></div>
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
Next js app with SSR is not pre-rendering HTML, so web ...
Within the auth context file, I was performing conditional rendering, depending on a loading state, which was causing SSR not to take place:....
Read more >Tabs - Reach UI
You can render any other elements you want inside of Tabs , but TabList should only render Tab elements, and TabPanels should only...
Read more >How To Crawl JavaScript Websites - Screaming Frog
Learn how to crawl JavaScript websites, SPAs, PWAs and frameworks such as React & Angular using the Screaming Frog SEO Spider tool.
Read more >Refreshing Server-Side Props - Next.js - Josh W Comeau
This brief tutorial shows how to re-fetch the props without doing a full ... After the page is server-rendered, those props are immutable....
Read more >Server Side Rendering - Search.io React SDK
If you're using @sajari/search-components with no search logic required... Copy. import { SSRProvider } from '@sajari/search-components'; export default () ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey! Thank you for your bug report! Much appreciated! 🙏
This should be fixed by #1155, and will be available in the next release.
You can already try it using
npm install @headlessui/react@insiders
oryarn add @headlessui/react@insiders
.same here. layout shifts are gone, though it introduced hydration error:
Warning: Did not expect server HTML to contain a <div> in <div>.