question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Single Story Hoisting isn't working

See original GitHub issue

Describe the bug Single story hoisting isn’t working

Expected behavior I expect the single story to be hoisted as described in the documentation

Screenshots Screen Shot 2021-03-27 at 12 29 37 PM

Code snippets

import { SimpleButton as SimpleButtonComponent } from './SimpleButton';

export default {
  title: 'Example/SimpleButton',
  component: SimpleButtonComponent,
  argTypes: {
    // backgroundColor: { control: 'color' },
    onClick: {},
  },
};

const Template = (args) => ({
  // Components used in your story `template` are defined in the `components` object
  components: { SimpleButtonComponent },
  // The story's `args` need to be mapped into the template through the `setup()` method
  setup() {
    return { args };
  },
  // And then the `args` are bound to your component with `v-bind="args"`
  template: '<simple-button v-bind="args" />',
});

export const SimpleButton = Template.bind({});
SimpleButton.args = {
  primary: true,
  label: 'Button',
};

System Environment Info:

System: OS: macOS 10.15.7 CPU: (12) x64 Intel® Core™ i9-8950HK CPU @ 2.90GHz Binaries: Node: 12.13.1 - ~/.nvm/versions/node/v12.13.1/bin/node Yarn: 1.22.10 - ~/.nvm/versions/node/v12.13.1/bin/yarn npm: 6.12.1 - ~/.nvm/versions/node/v12.13.1/bin/npm Browsers: Chrome: 89.0.4389.90 Firefox: 69.0.3 Safari: 14.0.3 npmPackages: @storybook/addon-actions: ^6.2.0-rc.7 => 6.2.0-rc.9 @storybook/addon-essentials: ^6.2.0-rc.7 => 6.2.0-rc.9 @storybook/vue3: ^6.2.0-rc.7 => 6.2.0-rc.9

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
ghengeveldcommented, Mar 28, 2021

Your names don’t match. Story exports are “title cased” to get the name, in this case Simple Button. Your component name (from title) is SimpleButton. Note the missing space.

Try title: 'Example/Simple Button'

Or if you don’t want the space, try SimpleButton.name = "SimpleButton"

Admittedly this is confusing. I wonder if we should consider the raw export name as well.

At very least we can update the docs with an example that reflects this scenario.

0reactions
sluthercommented, Apr 1, 2021

@sluther does it need to be single-button-component to line up with SingleButtonComponent?

That was indeed the issue. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Naming components and hierarchy - Storybook - JS.ORG
We recommend naming components according to the file hierarchy. Single story hoisting. Stories which have no siblings (i.e. the component has only one...
Read more >
1926.1431 - Hoisting personnel.
Personnel hoisting operations must not resume until the device is again working properly. Alternative measures are not permitted. (See § 1926.1417 for tag-out ......
Read more >
Hoisting. A little background story: | by Sam Bouguerra
Hoisting works with variable declarations using var but it doesn't work when the variables were declared with let or const. Function declarations are...
Read more >
How JavaScript hoisting actually works - Code Gino
Unfortunately, no hoisting JavaScript exists, as in the magical movement of declarations to the top. The word hoist does not even exist in...
Read more >
Hoisting - MDN Web Docs Glossary: Definitions of ... - Mozilla
Hoisting is not a term normatively defined in the ECMAScript specification. The spec does define a group of declarations as ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found