Do not merge p if not provided, if provided, no conditional is needed

This commit is contained in:
Norbert de Langen 2019-07-08 21:34:09 +02:00
parent 06c57aec43
commit e87c329e90
2 changed files with 10 additions and 6 deletions

View File

@ -52,7 +52,7 @@ function decorateStory(getStory, decorators) {
...p,
parameters: {
...context.parameters,
...(p && p.parameters),
...p.parameters,
},
}
: context

View File

@ -44,11 +44,15 @@ export const defaultDecorateStory = (storyFn: StoryFn, decorators: DecoratorFunc
(decorated, decorator) => (context: StoryContext = defaultContext) =>
decorator(
p =>
decorated({
...context,
...p,
parameters: { ...context.parameters, ...(p && p.parameters) },
}),
decorated(
p
? {
...context,
...p,
parameters: { ...context.parameters, ...p.parameters },
}
: context
),
context
),
storyFn