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

Common name prefix causes rapid switching between stories on load #11571

Closed
pelotom opened this issue Jul 16, 2020 · 9 comments
Closed

Common name prefix causes rapid switching between stories on load #11571

pelotom opened this issue Jul 16, 2020 · 9 comments

Comments

@pelotom
Copy link
Contributor

pelotom commented Jul 16, 2020

This appears to have been introduced in 6.0.0-beta.33.

Using these stories:

import { storiesOf } from '@storybook/react';
import React from 'react';

storiesOf('test', module)
  .add('x y', () => {
    console.log('render x y'); 
    return <div>x y</div>
  })
  .add('x', () => {
    console.log('render x');
    return <div>x</div>
  });

if you start on the "x" story and then reload the page, it will switch to the "x y" story, and the console prints

render x y
render x
render x y

(In my real project using typescript it actually switches between the 2 stories many more times, sometimes endlessly.)

This seems somehow related to the fact that the second story's name is a prefix of the first. If you change the second story name to "x z" the bug doesn't occur. It also doesn't occur if you change the order of the stories or change which one is selected at the beginning.

@pelotom
Copy link
Contributor Author

pelotom commented Jul 21, 2020

Ping? Just want to make sure this doesn't fall thru the cracks before the release!

@shilman
Copy link
Member

shilman commented Jul 22, 2020

Thanks for the ping @pelotom -- I missed this one somehow. Are you still seeing it on the latest RC? npx sb@next upgrade --prerelease to make sure all the packages are up to date. Possibly related: #11080

@pelotom
Copy link
Contributor Author

pelotom commented Jul 22, 2020

Hi @shilman, I tried with the latest and it's still happening.

@shilman
Copy link
Member

shilman commented Jul 22, 2020

Do you have a public repro you can share?

@pelotom
Copy link
Contributor Author

pelotom commented Jul 22, 2020

@tmeasday
Copy link
Member

I'll take a look, thanks @pelotom

@shilman
Copy link
Member

shilman commented Jul 22, 2020

Crikey!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.0.0-rc.14 containing PR #11637 that references this issue. Upgrade today to try it out!

You can find this prerelease on the @next NPM tag.

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

@shilman shilman closed this as completed Jul 22, 2020
@pelotom
Copy link
Contributor Author

pelotom commented Jul 22, 2020

Thanks guys!

@shilman
Copy link
Member

shilman commented Jul 27, 2020

Whoopee!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.0.0-rc.15 containing PR #11660 that references this issue. Upgrade today to try it out!

You can find this prerelease on the @next NPM tag.

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

3 participants