Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if hierarchySeparator presents in the options object #1561

Merged
merged 2 commits into from
Jul 31, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 });
}