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

Autotitle when not using storyStoreV7 #201

Closed
IanVS opened this issue Jan 10, 2022 · 2 comments · Fixed by #218
Closed

Autotitle when not using storyStoreV7 #201

IanVS opened this issue Jan 10, 2022 · 2 comments · Fixed by #218

Comments

@IanVS
Copy link
Member

IanVS commented Jan 10, 2022

Currently, autotitle does not work without enabling storyStoreV7. We need to provide a global STORIES like the webpack builder does here: https://github.com/storybookjs/storybook/blob/e0c0a1429dc123219dfd74c8c4a1c6bfc9660f74/lib/builder-webpack4/src/preview/iframe-webpack.config.ts#L191-L194, so that it can be used here: https://github.com/storybookjs/storybook/blob/e0c0a1429dc123219dfd74c8c4a1c6bfc9660f74/lib/client-api/src/StoryStoreFacade.ts#L156-L164

I've hit two snags so far. One, is that autoTitle uses path, which webpack polyfills but vite does not (there's a simple solution I have working, and I'll submit a PR to storybook soon). Second, the format of the loadable function we are providing to the call to configure does not include the filenames, which means that autoTitle does not name the stories correctly, defaulting to export_map_1, rather than the actual filename. Here is where the loadable is used: https://github.com/storybookjs/storybook/blob/e0c0a1429dc123219dfd74c8c4a1c6bfc9660f74/lib/core-client/src/preview/executeLoadable.ts#L12, and this is how we are currently setting it up: https://github.com/eirslett/storybook-builder-vite/blob/fb289c1cb57c3b929eb5f586e87b7644f97e28be/packages/storybook-builder-vite/codegen-iframe-script.ts#L103-L106.

@joshwooding
Copy link
Collaborator

The second snag is reported here with a potential solution #142

@IanVS
Copy link
Member Author

IanVS commented Jan 10, 2022

PR to remove path: storybookjs/storybook#17185

IanVS added a commit that referenced this issue Feb 18, 2022
Fixes #201 

This enables the omission of `title` properties in the default export of stories (the new storybook "autotitle" feature).  It's a little less powerful without #182, but it's still nice to support this, I think.

I did notice an issue with HMR, but it seems not to be introduced in this PR, but exists in the react example on main as well.  Changing a css value _does_ still HMR, so I think there is no regression here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants