Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch for Issue 9294 #9698

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/addons/src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export const applyHooks = (
const { hooks } = context;
hooks.prevMountedDecorators = hooks.mountedDecorators;
hooks.mountedDecorators = new Set([getStory, ...decorators]);
hooks.currentContext = context;
hooks.currentContext = Object.assign({}, context, { hooks: null });
Copy link
Member

@ndelangen ndelangen Feb 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would ensure the ref to hooks.currentContext is always new/different.

And it would always overload context.hooks with null

That doesn't seem right to me.

What about:

Suggested change
hooks.currentContext = Object.assign({}, context, { hooks: null });
hooks.currentContext = context || { hooks: null };

?

hooks.hasUpdates = false;
let result = decorated(context);
numberOfRenders = 1;
Expand Down