Skip to content

Commit

Permalink
Check if hierarchySeparator presents in the options object
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-dv committed Jul 31, 2017
1 parent e3bcd4d commit bef736a
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 bef736a

Please sign in to comment.