Skip to content

Commit

Permalink
Handle propTables=false properly
Browse files Browse the repository at this point in the history
The propTables prop is an array type but the option
may be set to false. Change it to null to avoid warnings
  • Loading branch information
thani-sh committed Aug 11, 2016
1 parent e2bf9c0 commit 7d235fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/Story.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export default class Story extends React.Component {
_getPropTables() {
const types = new Map();

if (this.props.propTables === false) {
if (this.props.propTables === null) {
return null;
}

Expand Down
7 changes: 7 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ export default {
..._options
};

// props.propTables can only be either an array of components or null
// propTables option is allowed to be set to 'false' (a boolean)
// if the option is false, replace it with null to avoid react warnings
if (!options.propTables) {
options.propTables = null;
}

this.add(storyName, (context) => {
const props = {
info,
Expand Down

0 comments on commit 7d235fb

Please sign in to comment.