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

Avoid rebinding story during decoration #14677

Closed
wants to merge 4 commits into from

Conversation

tmeasday
Copy link
Member

Issue: #12255

What I did

Rather than using a closure and rebinding the story function with the context as it is decorated, instead use a getStoryContext() function on the store to find out the context of the rendering story.

How to test

  • Is this testable with Jest or Chromatic screenshots?

There is a Chromatic test. Not sure if we need a test for getStoryContext, it isn't really intended to be used externally.

  • Does this need a new example in the kitchen sink apps?

See above.

  • Does this need an update to the documentation?

No

@github-actions
Copy link
Contributor

github-actions bot commented Apr 21, 2021

Fails
🚫

PR is not labeled with one of: ["cleanup","BREAKING CHANGE","feature request","bug","documentation","maintenance","dependencies","other"]

Generated by 🚫 dangerJS against d8af7ed

Comment on lines 145 to 149
export type DecorateStoryFunction<StoryFnReturnType = unknown> = (
storyFn: StoryFn<StoryFnReturnType>,
decorators: DecoratorFunction<StoryFnReturnType>[]
decorators: DecoratorFunction<StoryFnReturnType>[],
getStoryContext: () => StoryContext
) => StoryFn<StoryFnReturnType>;
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure if it is an issue that I changed this type here?

lib/client-api/src/story_store.ts Outdated Show resolved Hide resolved
@tmeasday
Copy link
Member Author

tmeasday commented Apr 22, 2021

Attempt #4 => #14692

@tmeasday tmeasday closed this Apr 22, 2021
@stof stof deleted the 12255-fix-jsx-decorators-3 branch May 25, 2022 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants