Skip to content

Commit

Permalink
Merge pull request #1561 from storybooks/fix-hierarchySeparator-defau…
Browse files Browse the repository at this point in the history
…lt-null-in-options

Check if hierarchySeparator presents in the options object
  • Loading branch information
shilman authored Jul 31, 2017
2 parents 85de359 + e6980d3 commit 3eef46e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions addons/options/src/preview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,17 @@ export function setOptions(newOptions) {
'Failed to find addon channel. This may be due to https://github.com/storybooks/storybook/issues/1192.'
);
}
const options = {
...newOptions,
hierarchySeparator: regExpStringify(newOptions.hierarchySeparator),
};

let options = newOptions;

// since 'undefined' and 'null' are the valid values we don't want to
// override the hierarchySeparator if the prop is missing
if (Object.prototype.hasOwnProperty.call(newOptions, 'hierarchySeparator')) {
options = {
...newOptions,
hierarchySeparator: regExpStringify(newOptions.hierarchySeparator),
};
}

channel.emit(EVENT_ID, { options });
}

0 comments on commit 3eef46e

Please sign in to comment.