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: Opt out of dynamic snippet rendering #11526

Closed
shilman opened this issue Jul 13, 2020 · 10 comments
Closed

Addon-docs: Opt out of dynamic snippet rendering #11526

shilman opened this issue Jul 13, 2020 · 10 comments

Comments

@shilman
Copy link
Member

shilman commented Jul 13, 2020

#11332 added dynamic source rendering for React, but many users prefer the existing 5.3 behavior. So we should give them the ability to opt out of the new behavior, at least until we've made it more bulletproof.

@kylegach
Copy link
Contributor

Want to give something stronger than just a "thumbs up" for this.

I tried v6 RC.4 yesterday and the snippet rendering for our project was broken or otherwise inadequate for all but the simplest of story sources (using the "CSF stories with arbitrary MDX" recipe). For some, it even hit callstack limits and broke the page entirely. Basically, we hit many of the issues captured here (https://github.com/storybookjs/addon-jsx/issues) and here (https://github.com/algolia/react-element-to-jsx-string/issues), specifically the displayName problem with the newer React features and, not necessarily a bug, but the snippets aren't nearly as useful for documentation if they only display the returned JSX and not the entire source.

Happy to try to produce simplified test case(s), if that would be helpful, though I suspect I should mostly direct that feedback at the upstream library.

Thanks! And other than this, V6 was looking and feeling great!

@shilman
Copy link
Member Author

shilman commented Jul 16, 2020

@kylegach thanks for the feedback. i knew this was a rats nest when I started us down this path, but we'll get it sorted out. opting out will be a good escape valve for people who were satisfied with the v5 behavior.

@shilman
Copy link
Member Author

shilman commented Jul 18, 2020

Good golly!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.0.0-rc.10 containing PR #11601 that references this issue. Upgrade today to try it out!

You can find this prerelease on the @next NPM tag.

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed Jul 18, 2020
@TomWija
Copy link

TomWija commented Jul 20, 2020

So I updated to rc.11 and now stories that used to have code-snippets generated for them are just showing "No Code Available"

export const Test = () => {
    const foo = "foobar"
    return (
        <div>
            { foo }
        </div>
    )
}

results in this:

image

Back in v5.0.0 this would have given us the source instead

@shilman
Copy link
Member Author

shilman commented Jul 20, 2020

@TomWija do you have a repro I can look at?

@TomWija
Copy link

TomWija commented Jul 20, 2020

Here's one I put together that replicates the problem
https://github.com/TomWija/storybook-source-test

@shilman
Copy link
Member Author

shilman commented Jul 20, 2020

Thanks @TomWija, I'll try to get out a fix in the next RC 🙈

@shilman
Copy link
Member Author

shilman commented Jul 22, 2020

¡Ay Caramba!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.0.0-rc.14 containing PR #11650 that references this issue. Upgrade today to try it out!

You can find this prerelease on the @next NPM tag.

@kylegach
Copy link
Contributor

FYI, all of my issues are resolved as of RC15! 🎉 I don't even have to use this opt out. 🙃

@shilman
Copy link
Member Author

shilman commented Jul 29, 2020

@kylegach great news! will be tweaking this more before release -- hopefully I don't break anything for you 🙈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants