From 68b53cd9830c8b235447a1e3180a342c46b97123 Mon Sep 17 00:00:00 2001 From: atanasster Date: Thu, 29 Oct 2020 01:15:26 -0400 Subject: [PATCH] fix: nextfn for renderFn parameter --- core/render/src/react.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/core/render/src/react.tsx b/core/render/src/react.tsx index 6f2112297..50385faaa 100644 --- a/core/render/src/react.tsx +++ b/core/render/src/react.tsx @@ -31,15 +31,13 @@ export const render: FrameworkRenderFn = (story, doc, options: any = {}) => { for (let i = 0; i < sortedDecorators.length; i += 1) { const decorator = sortedDecorators[i]; const childFn = renderFn; + const nextFn = (_: any, nexContext: any) => + (childFn as StoryRenderFn)(values, { ...context, ...nexContext }); renderFn = () => - decorator( - (_: any, nexContext: any) => - (childFn as StoryRenderFn)(values, { ...context, ...nexContext }), - { - ...context, - renderFn: childFn, - }, - ); + decorator(nextFn, { + ...context, + renderFn: nextFn, + }); } let node: any = null; node = () => (renderFn as StoryRenderFn)(values, context);