Storybook: Receiving warning when story name is "Map"

Created on 21 Mar 2019  路  13Comments  路  Source: storybookjs/storybook

Describe the bug
When the story name is "Map". For example:

storiesOf('Map', module)
    .add('default', () => <Map/>)

I receive the following console warning

Warning: Failed prop type: Invalid prop `isExpanded` of type `function` supplied to `SidebarItem`, expected `boolean`.
    in SidebarItem
    in Unknown (created by Tree)
    in Tree (created by TreeState)
    in section (created by Context.Consumer)
    in Styled(section) (created by TreeState)
    in TreeState
    in div (created by Context.Consumer)
    in Styled(div)
    in Unknown
    in Unknown (created by Context.Consumer)
    in Styled(Component) (created by Sidebar)
    in nav (created by Context.Consumer)
    in Styled(nav) (created by Sidebar)
    in Sidebar (created by Context.Consumer)
    in _default (created by Layout)
    in div (created by Context.Consumer)
    in Styled(div) (created by Nav)
    in Nav (created by Layout)
    in Layout (created by Context.Consumer)
    in WithTheme(Layout) (created by ResizeDetector)
    in ResizeDetector
    in div (created by Context.Consumer)
    in Styled(div)
    in Unknown
    in Unknown (created by ResizeDetector)
    in ResizeDetector
    in Unknown
    in Unknown (created by Manager)
    in ThemeProvider (created by Manager)
    in Manager (created by Context.Consumer)
    in Location (created by QueryLocation)
    in QueryLocation (created by Root)
    in LocationProvider (created by Root)
    in HelmetProvider (created by Root)
    in Root

To Reproduce
Steps to reproduce the behavior:

  1. npx create-react-app storybook-bug
  2. cd storybook-bug
  3. npx -p @storybook/cli sb init
  4. Change one of the default story names to "Map"
  5. yarn run storybook
  6. Wait for it to load and check the console.

System:

  • OS: MacOS
  • Device: Macbook Pro 2015
  • Browser: chrome
  • Framework: react
  • Addons: none
  • Version: 5.0.3

Additional context
Wasn't an issue in 4.1.13. Appeared in 5.0.0. Obviously the easy solution is to not name any stories Map. I just found it peculiar

core has workaround needs reproduction question / support

All 13 comments

That's pretty bizarre. Ring any bells @ndelangen ?

I've got the same warning. I don't have any story named Map.
v5.0.3

Same issue here, but the problem story is called Filter.

maybe all array functions are problematic?

Could you confirm the problem in 5.1.0-alpha.13? I can't reproduce.

I'm having the exact same issue. 5.0.5 currently but had same issues at earlier 5.x.x versions. I have a "Map" story as well which probably broke it.

@Armanio I just confirmed it's still an issue in 5.1.0-alpha.14 and 5.0.5.

Steps to reproduce

  1. npx create-react-app storybook-bug && cd $_
  2. npx -p @storybook/[email protected] sb init
  3. Edit stories/index.js and change storiesOf('Button', module) to storiesOf('map', module)
  4. yarn run storybook
  5. Check chrome console. You will need to refresh the page if you previously opened console before changing the story name.

The warning triggers when a story is named the same as any array functions regardless of case (ie: map/Map, reduce/Reduce, filter/Filter, splice/Splice, etc) except for the camel-cased functions (ie indexOf, forEach etc).

I'm able to reproduce the warning if I follow the steps @jakehewitt provides above by creating a new project and then installing storybook as a dependency. However, I cannot reproduce this if I use the cra-kitchen-sink example inside the storybook repo, or if I yarn link my local storybook from the external project.

Is there a production build or something that needs to run to reproduce this from within storybook? I investigated this bug a bit and have a potential fix, but I'm unable to test it at the moment.

@dougmacknz Perhaps you need to run your storybook with the --no-dll option?

Thanks @shilman - that works. I'll have PR up with a fix for this a bit later on.

@dougmacknz i'm super curious .. thanks for taking this on!!!

Zoinks!! I just released https://github.com/storybooks/storybook/releases/tag/v5.1.0-alpha.18 containing PR #6290 that references this issue. Upgrade today to try it out!

Because it's a pre-release you can find it on the @next NPM tag.

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

Ol茅!! I just released https://github.com/storybooks/storybook/releases/tag/v5.0.6 containing PR #6290 that references this issue. Upgrade today to try it out!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dnlsandiego picture dnlsandiego  路  3Comments

zvictor picture zvictor  路  3Comments

arunoda picture arunoda  路  3Comments

levithomason picture levithomason  路  3Comments

tomitrescak picture tomitrescak  路  3Comments