Skip to content

Commit

Permalink
fix: pass decorators first param
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Oct 14, 2020
1 parent 607a045 commit ad8c358
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions core/render/src/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,22 @@ export const render: FrameworkRenderFn = async (
for (let i = 0; i < sortedDecorators.length; i += 1) {
const decorator = sortedDecorators[i];
const childFn = renderFn;
if (isPromise(decorator)) {
renderFn = await decorator(values, {
...context,
renderFn: childFn,
});
} else {
renderFn = () =>
decorator(values, {
renderFn = () =>
decorator(
(_: any, nexContext: any) =>
(childFn as StoryRenderFn)(values, { ...context, ...nexContext }),
{
...context,
renderFn: childFn,
});
}
},
);
}
let node: any = null;
if (renderFn) {
if (story.async || isPromise(renderFn)) {
node = await (renderFn as any)(values, context);
node = await (renderFn as StoryRenderFn)(values, context);
} else {
node = () => (renderFn as any)(values, context);
node = () => (renderFn as StoryRenderFn)(values, context);
}
}
return createElement(node);
Expand Down

0 comments on commit ad8c358

Please sign in to comment.