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

Group name includes leading and trailing whitespace #13311

Closed
x4th opened this issue Nov 27, 2020 · 10 comments
Closed

Group name includes leading and trailing whitespace #13311

x4th opened this issue Nov 27, 2020 · 10 comments

Comments

@x4th
Copy link

x4th commented Nov 27, 2020

I'm trying to move one component group to the top to have it displayed before all others.

// .storybook/preview.tsx

export const parameters = {
  options: {
    storySort: {
      order: ['Line Items'],
    },
  },
}

This however has no effect and when I looked inside the related story I see I used:

// components/LineItems/SingleLineItems.stories.tsx

export default {
  component: SingleLineItem,
  title: 'Line Items / Single Line Item',
}

If I change order: ['Line Items'], to order: ['Line Items '], in the first file or title: 'Line Items / Single Line Item', to title: 'Line Items/Single Line Item', the group moves to the top. If there's a reason why whitespace here should matter you should at least make a note in the docs warning users to not have spaces around the slash.

@ghengeveld
Copy link
Member

ghengeveld commented Dec 3, 2020

Related: #13275
This was released in 6.2.0-alpha.0. @x4th could you check if this problem goes away using that version of Storybook?

@stale
Copy link

stale bot commented Dec 25, 2020

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Dec 25, 2020
@x4th
Copy link
Author

x4th commented Jan 19, 2021

Hey, can you tell me how to do that? I tried running yarn add storybook@6.2.0-alpha.0 but when I run storybook (yarn storybook) which is start-storybook -p 6006 that still calls the old (stable) version. I checked the docs but couldn't find anything on this.

@stale stale bot removed the inactive label Jan 19, 2021
@ghengeveld
Copy link
Member

@x4th You probably need to run with --no-manager-cache.

@bodograumann
Copy link
Contributor

I have the exact same issue with storybook v6.2.9.
The only difference is, that I’m defining the stories in mdx format.

@ghengeveld
Copy link
Member

@bodograumann Can you give an example of such a story file?

@bodograumann
Copy link
Contributor

At least it is consistent, so that when I include the trailing space in the sort order, it works. :-D
Here is an example:

import { ArgsTable, Meta, Story } from "@storybook/addon-docs/blocks";
import Toast from "@/components/generic/Toast.vue";

<Meta title="Generic / Toast" component={Toast} />

# Toast

<ArgsTable />

Toast messages come in three flavors.

## Information

<Story name="Notice">
  {{
    components: { Toast },
    template: `
    <Toast
      severity="info"
      title="Notice"
      text="An alert has been triggered."
    />
  `,
  }}
</Story>

I left away the other two stories for brevity.

Relevant preview.js part goes along the lines of:

export const parameters = {
  options: {
    storySort: {
      method: "alphabetical",
      order: [
        "Generic ",
        "Section2 ",
        "Section3 ",
        "… ",
      ],
    },
  },
};

@ghengeveld
Copy link
Member

@bodograumann Thanks. I confirmed an fixed the problem: #15038

@shilman
Copy link
Member

shilman commented May 26, 2021

Olé!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.3.0-beta.1 containing PR #15038 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease

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

@shilman shilman closed this as completed May 26, 2021
@bodograumann
Copy link
Contributor

Just upgraded to 6.3-rc.11 and it works very well. Thank 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

4 participants