Skip to content

Commit

Permalink
Merge pull request #262 from 4dn-dcic/utk_toc_bug_fix
Browse files Browse the repository at this point in the history
Bug Fix - Table of Content props.children handling
  • Loading branch information
utku-ozturk authored Sep 6, 2024
2 parents fd0221c + 1bf2d1a commit e0ffcd9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion es/components/static-pages/TableOfContents.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ var TableEntry = /*#__PURE__*/function (_React$Component) {
}(React.Component);
_defineProperty(TableEntry, "getChildHeaders", memoize(function (content, maxHeaderDepth, currentDepth) {
if (!TableOfContents.isContentJSX(content) || !content.props || !content.props.children) return [];
return content.props.children.filter(function (child) {
return React.Children.toArray(content.props.children).filter(function (child) {
return TableOfContents.isHeaderComponent(child, maxHeaderDepth || 6) && child.props.type === 'h' + (currentDepth + 1);
});
}));
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hms-dbmi-bgm/shared-portal-components",
"version": "0.1.89",
"version": "0.1.90",
"description": "Shared components used for DBMI/BGM portal(s).",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion src/components/static-pages/TableOfContents.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class TableEntry extends React.Component {

static getChildHeaders = memoize(function(content, maxHeaderDepth, currentDepth){
if (!TableOfContents.isContentJSX(content) || !content.props || !content.props.children) return [];
return content.props.children.filter(function(child,i,a){
return React.Children.toArray(content.props.children).filter(function(child,i,a){
return TableOfContents.isHeaderComponent(child, maxHeaderDepth || 6) && (child.props.type === 'h' + (currentDepth + 1));
});
});
Expand Down

0 comments on commit e0ffcd9

Please sign in to comment.