theKashey / storybook-include

Folder based storybook configuration for monorepos
MIT License
10 stars 2 forks source link

This add-on breaks "View Code" #4

Open matthew-dean opened 2 years ago

matthew-dean commented 2 years ago

Our scenario. We have a story like this:

<Button>
  default
</Button>

When you go to show code in Storybook Docs it renders like this:

<Button>
  default
</Button>

However, we've set up this add on with the following decorator:

export default () => {
  addStoryDecorators(() => [
    Story => (
      <ThemeProvider theme={theme}>
        <GlobalStyles />
        <Story />
      </ThemeProvider>
    )
  ])
}

This results in Show Code showing:

<Fe
  theme={{
    // entire theme object
  }}
>
  <GlobalStyles />
  <No Display Name />
</Fe>

Is there a way to fix this?

theKashey commented 2 years ago

This should not happen:

But might be I am improperly reading "When you go to view code in Storybook Docs". What is "view code"?

matthew-dean commented 2 years ago

Go to Docs. Click on "Show code"

Screen Shot 2022-05-12 at 1 31 55 PM
matthew-dean commented 2 years ago

Without storybook-include, in Docs mode

Screen Shot 2022-05-12 at 1 35 13 PM

With storybook-include

Screen Shot 2022-05-12 at 1 36 06 PM
matthew-dean commented 2 years ago

Note that setting global decorators in preview.js does not have this effect. This is specific to this package.

matthew-dean commented 2 years ago

Any progress on this? Thanks!

theKashey commented 2 years ago

Waiting for some free time to handle tasks outside of a normal job 😞