Skip to content

Commit

Permalink
fix: workaround new bug in SB RC
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Jul 11, 2020
1 parent a086694 commit 66112b5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ui/blocks/src/Story/Story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ export const Story: FC<StoryProps> = forwardRef(
const { decorators: globalDecorators = [] } = options;
const { decorators: storyDecorators = [] } = story;
const decorators = deepMerge(globalDecorators, storyDecorators);
//parameters added to avoid bug in SB6 rc that it assumes parameters exist
const storyContext = { ...context, parameters: {} };
const renderFn = decorators.reverse().reduce(
(acc: StoryRenderFn, item: StoryRenderFn) => () =>
item(acc, { ...context, renderFn: acc }),
item(acc, { ...storyContext, renderFn: acc }),
//@ts-ignore
() => story.renderFn(values, context),
() => story.renderFn(values, storyContext),
);
return (
<Box
Expand Down

0 comments on commit 66112b5

Please sign in to comment.