Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit 753bc3c

Browse files
Check if props has children before parsing
1 parent 3a94322 commit 753bc3c

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

dash_core_components/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dash_core_components/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2906,7 +2906,7 @@
29062906
"required": false,
29072907
"description": "Holds the colors used by the Tabs and Tab components. If you set these, you should specify colors for all properties, so:\ncolors: {\n border: '#d6d6d6',\n primary: '#1975FA',\n background: '#f9f9f9'\n }",
29082908
"defaultValue": {
2909-
"value": "{\n border: '#d6d6d6',\n primary: '#1975FA',\n background: '#f9f9f9'\n}",
2909+
"value": "{\n border: '#d6d6d6',\n primary: '#1975FA',\n background: '#f9f9f9',\n}",
29102910
"computed": false
29112911
}
29122912
}

dash_core_components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"test-debug": "./node_modules/.bin/builder run test-frontend-debug",
2323
"uninstall-local": "pip uninstall dash-core-components -y",
2424
"build:js": "webpack --mode production",
25-
"build:py": "node ./extract-meta src/components > dash_core_components/metadata.json && copyfiles package.json dash_core_components && npm run generate-python-classes"
25+
"build:py": "node ./extract-meta src/components > dash_core_components/metadata.json && cp package.json dash_core_components && npm run generate-python-classes"
2626
},
2727
"author": "Chris Parmer <[email protected]>",
2828
"license": "MIT",

src/components/Tabs.react.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export default class Tabs extends Component {
136136
}
137137
}
138138
parseChildrenToArray() {
139-
if (!R.is(Array, this.props.children)) {
139+
if (this.props.children && !R.is(Array, this.props.children)) {
140140
// if dcc.Tabs.children contains just one single element, it gets passed as an object
141141
// instead of an array - so we put in in a array ourselves!
142142
this.props.children = [this.props.children];
@@ -163,21 +163,25 @@ export default class Tabs extends Component {
163163
let selectedTab;
164164
let selectedTabContent;
165165

166-
this.parseChildrenToArray();
167-
168166
if (this.props.children) {
167+
this.parseChildrenToArray();
168+
169169
const amountOfTabs = this.props.children.length;
170170

171+
window.console.log('this.props.children', this.props.children);
171172
EnhancedTabs = this.props.children.map((child, index) => {
172173
// TODO: handle components that are not dcc.Tab components (throw error)
173174
// enhance Tab components coming from Dash (as dcc.Tab) with methods needed for handling logic
174175
let childProps;
175176

177+
window.console.log('child', child);
178+
176179
if (child.props.children) {
177180
// if props appears on .children, props are coming from Dash
178181
childProps = child.props.children.props;
179182
} else {
180183
// else props are coming from React (Demo.react.js)
184+
window.console.log('child props', child.props);
181185
childProps = child.props;
182186
}
183187

0 commit comments

Comments
 (0)