diff --git a/CHANGELOG-2.x.md b/CHANGELOG-2.x.md index 999e9334c482..a642982a4660 100644 --- a/CHANGELOG-2.x.md +++ b/CHANGELOG-2.x.md @@ -2,6 +2,7 @@ ## Unreleased +- **HOTFIX for 2.0.0-alpha.32** - Fix build compilation if exists only one code tab. - Add table of contents highlighting on scroll. ## 2.0.0-alpha.32 diff --git a/packages/docusaurus-theme-classic/src/theme/Tabs/index.js b/packages/docusaurus-theme-classic/src/theme/Tabs/index.js index a2b9d883fd97..7aae32d9f433 100644 --- a/packages/docusaurus-theme-classic/src/theme/Tabs/index.js +++ b/packages/docusaurus-theme-classic/src/theme/Tabs/index.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import React, {useState} from 'react'; +import React, {useState, Children} from 'react'; import classnames from 'classnames'; @@ -31,7 +31,11 @@ function Tabs(props) { ))}
- {[...children].filter(child => child.props.value === selectedValue)[0]} + { + Children.toArray(children).filter( + child => child.props.value === selectedValue, + )[0] + }
);