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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2] Tabs fail to render when they have only one child #3822

Closed
aeneasr opened this issue Nov 26, 2020 · 2 comments 路 Fixed by #3823
Closed

[v2] Tabs fail to render when they have only one child #3822

aeneasr opened this issue Nov 26, 2020 · 2 comments 路 Fixed by #3823
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@aeneasr
Copy link
Contributor

aeneasr commented Nov 26, 2020

馃悰 Bug Report

(A clear and concise description of what the bug is)

Have you read the Contributing Guidelines on issues?

yes

To Reproduce

In a mdx file, write:

import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'

<Tabs
  defaultValue="node"
  values={[
    {label: 'NodeJS', value: 'node'},
  ]}>
  <TabItem value="node">
    asdf
  </TabItem>
</Tabs>

Expected behavior

This will fail to render with index.js?3e4b:6 Uncaught (in promise) TypeError: children.map is not a function caused by 8c9f948 and more specifically the removal of 8c9f948#diff-5548122e1da708235c90f8d8cc552ffa69c199f1dd82ca505c9577ac7255da73L114

Adding a non-sense tab like so will fix this:

import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'

<Tabs
  defaultValue="node"
  values={[
    {label: 'NodeJS', value: 'node'},
  ]}>
  <TabItem value="node">
    asdf
  </TabItem>
  <TabItem value="placeholder" />
</Tabs>

Actual Behavior

Rendering should not fail

Your Environment

  • Docusaurus version used: alpha 69

Reproducible Demo

(Paste the link to an example repo, including a siteConfig.js, and exact instructions to reproduce the issue.)

@aeneasr aeneasr added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Nov 26, 2020
aeneasr added a commit to aeneasr/Docusaurus that referenced this issue Nov 26, 2020
slorber added a commit that referenced this issue Nov 26, 2020
* fix(v2): support rendering of singular tabs

Closes #3822

* Update index.tsx

* fix type

Co-authored-by: slorber <lorber.sebastien@gmail.com>
@Josh-Cena Josh-Cena removed the status: needs triage This issue has not been triaged by maintainers label Mar 10, 2022
@doucol
Copy link

doucol commented Jan 27, 2023

I'm seeing evidence that this has resurfaced with the 2.3 release. We had one page with a single tab in the tabset and it was causing the TypeError: children.map is not a function error. Removed the tabset and error disappears.

@Josh-Cena
Copy link
Collaborator

Let's track the new error in #8591

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants