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

Addon-docs: Fix inline stories using react hooks #7946

Merged
merged 1 commit into from
Sep 1, 2019

Conversation

atanasster
Copy link
Member

@atanasster atanasster commented Aug 31, 2019

Issue: #7924

What I did

Replaced the storyFn instead of direct call, to be rendered as a react element

How to test

added reactHook story to Stories.stories.tsx and can be tested in official-storybook

@vercel
Copy link

vercel bot commented Aug 31, 2019

This pull request is automatically deployed with Now.
To access deployments, click Details below or on the icon next to each push.

@ndelangen ndelangen added this to the 5.2.0 milestone Aug 31, 2019
@shilman shilman changed the title fix for inline stories using react hooks Addon-docs: Fix inline stories using react hooks Sep 1, 2019
@shilman
Copy link
Member

shilman commented Sep 1, 2019

cc @Aaron-Pool can you take a quick look?

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

Thanks @atanasster! Good catch and great fix!

@Aaron-Pool
Copy link
Contributor

@shilman as to if this will have any effect on inlining other frameworks--shouldn't be a problem. I can just set storyFn directly to the result of prepareForInline, rather than to a function that returns that result.

As for most everything else in this PR, my knowledge of React hooks and React rendering is pretty limited, so... LGTM? 🤷‍♂️

@atanasster
Copy link
Member Author

@Aaron-Pool - my vue.js is like your react :) Can you help me - how do you test the vue.js integration, I can try to run some tests on my end.
On the other hand, I think the preview window was already using the react magic for rendering and the stories with hooks were not breaking there.

@Aaron-Pool
Copy link
Contributor

Aaron-Pool commented Sep 1, 2019

@atanasster this almost certainly won't break any current Vue functionality. 5.2 only supports iframe-based stories for non-react frameworks (e.g. Vue), so changes to inline rendering shouldn't effect the Vue side of things yet. Shilman tagged me (I assume) because of a PR I'm doing for 5.3 to add inline rendering support for Vue, as well as a path to inline support for other frameworks.

But yes, like you said, story preview is already pretty tightly bound to react magic, so these changes shouldn't impede my project. Might have to make a few tiny tweaks, but it should be fine! 👍

@shilman
Copy link
Member

shilman commented Sep 1, 2019

You guys are awesome. 💯 Merging this!

Recategorizing as a bug since we're in RC mode and only merging bugfixes. We're claiming React hooks support in 5.2, so I think it's appropriate.

@shilman shilman merged commit 5b7763d into storybookjs:next Sep 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants