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

Unwanted "Es Module" story added to each story #8450

Closed
denvash opened this issue Oct 17, 2019 · 1 comment
Closed

Unwanted "Es Module" story added to each story #8450

denvash opened this issue Oct 17, 2019 · 1 comment

Comments

@denvash
Copy link

denvash commented Oct 17, 2019

Describe the bug
Es Module story was added for each of my stories.

To Reproduce
Steps to reproduce the behavior:

  1. Run storybook yarn storybook
  2. Check each story

Expected behavior
Es Module won't appear

Screenshots

Stories tabs

image

Es Module story

image

Code snippets

// @config.js
import React, { useContext } from 'react';
import { configure, addParameters, addDecorator } from '@storybook/react';
import { themes } from '@storybook/theming';
import { radios, withKnobs } from '@storybook/addon-knobs';
import { ThemeContext } from 'styled-components';

import GlobalStyle from '../src/styles/GlobalStyle.styles';
import ThemeProvider from '../src/components/ThemeProvider';
import theme from '../src/styles/theme';

const reducer = (acc, { name }, i) => {
  acc[name] = String(i);
  return acc;
};

const label = 'Themes';
const options = theme.palettes.reduce(reducer, {});
const defaultValue = Object.values(options)[0];

const Container = ({ children }) => {
  const controlledIndex = radios(label, options, defaultValue);
  const { setIndex } = useContext(ThemeContext);
  setIndex(Number(controlledIndex));
  return <>{children}</>;
};

addDecorator(withKnobs);
addDecorator(S => (
  <ThemeProvider>
    <Container>
      <GlobalStyle />
      <S />
    </Container>
  </ThemeProvider>
));

addParameters({
  options: {
    panelPosition: 'bottom',
    storySort: (a, b) => a[1].id.localeCompare(b[1].id),
    theme: themes.dark,
  },
});

System:

Environment Info:

  System:
    OS: Linux 4.15 Ubuntu 18.04.3 LTS (Bionic Beaver)
    CPU: (8) x64 Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
  Binaries:
    Node: 12.10.0 - /usr/local/bin/node
    Yarn: 1.19.1 - /usr/bin/yarn
    npm: 6.10.3 - /usr/local/bin/npm
  Browsers:
    Chrome: 77.0.3865.120
    Firefox: 69.0.2
  npmPackages:
    @storybook/addon-actions: ^5.2.3 => 5.2.3 
    @storybook/addon-knobs: ^5.2.3 => 5.2.3 
    @storybook/addon-links: ^5.2.3 => 5.2.3 
    @storybook/addon-viewport: ^5.2.3 => 5.2.3 
    @storybook/addons: ^5.2.3 => 5.2.3 
    @storybook/react: ^5.2.3 => 5.2.3 

Additional context
I believe it has to do with addDecorates(withKnobs),
reproducible example in my portfolio: https://github.com/denvash/dennisvash.com

  1. yarn install
  2. yarn storybook
@shilman
Copy link
Member

shilman commented Oct 17, 2019

Duplicate to #8080 fixed in 5.2.4

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

2 participants