storybookjs/storybook

[Bug]: Story not selected on initial load

Ouverte

#22 862 ouverte le 31 mai 2023

 (5 commentaires) (2 réactions) (0 personne assignée)TypeScript (10 058 forks)batch import
bugbuild-storybookcompatibility with other toolshas workaroundhelp wanted

Métriques du dépôt

Stars
 (89 909 étoiles)
Métriques de merge PR
 (Merge moyen 7j 22h) (184 PRs mergées en 30 j)

Description

Describe the bug

I've recently upgraded a Storybook project from version 6.5 to 7. I've noticed an issue with the production build, where if I refresh my browser while on a story page, I get the message, "Sorry, but you either have no stories or none are selected somehow.". A story won't show up until I click on another in the sidebar.

I cloned Storybook's design system repo, built a production build and saw the same issue. If, for example, I'm looking at the Button docs or if I paste this URL directly into the browser, the story / docs don't show.

Is this a feature, or is there a way to get around this issue? Or maybe I'm missing something else?

To Reproduce

Issue can be recreated with Storybook's design system repo.

$ npm run build-storybook
$ npx serve storybook-static

System

Environment Info:

  System:
    OS: macOS 12.5
    CPU: (8) arm64 Apple M2
  Binaries:
    Node: 18.16.0 - /usr/local/bin/node
    npm: 9.5.1 - /usr/local/bin/npm
  Browsers:
    Chrome: 113.0.5672.126
    Safari: 15.6
  npmPackages:
    @storybook/addon-a11y: ^7.0.2 => 7.0.2 
    @storybook/addon-actions: ^7.0.2 => 7.0.2 
    @storybook/addon-docs: ^7.0.2 => 7.0.2 
    @storybook/addon-essentials: ^7.0.2 => 7.0.2 
    @storybook/addon-storysource: ^7.0.2 => 7.0.2 
    @storybook/eslint-config-storybook: ^3.1.2 => 3.1.2 
    @storybook/linter-config: ^3.1.2 => 3.1.2 
    @storybook/react: ^7.0.2 => 7.0.2 
    @storybook/react-webpack5: ^7.0.2 => 7.0.2 
    @storybook/theming: ^7.0.2 => 7.0.2

Additional context

No response

Guide contributeur