-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
[Bug]: Story redirects worked in v6 but don't work in v7 #24292
Comments
@tmeasday thoughts? I think you updated the redirect in v7 |
I think it was intended to work for sure, this is a bug. Does it fix it if you set the |
On my end, I am setting A temporary workaround I've implemented is to register an addon: import {STORY_MISSING} from '@storybook/core-events';
import {addons} from '@storybook/manager-api';
addons.register('SELECT-FIRST-STORY-BY-DEFAULT-ONCE', (api) => {
api.once(STORY_MISSING, () => {
const currentId = api.getUrlState().storyId;
if (!currentId) {
return api.selectFirstStory();
}
api.selectStory(currentId);
});
}); |
@ndelangen this behaviour was broken in this PR: https://github.com/storybookjs/storybook/pull/23307/files The preview is emitting the right events ( I guess we didn't take this use case into account. Should be possible to write an E2E test to ensure we don't regress again (after fixing). |
Describe the bug
Automatic redirects to the first story within a section worked in Storybook v6 but don't work in v7.
Examples:
Couldn't find story matching id 'example-button' after HMR.
I found the redirect really useful because it allowed me to link to general sections in static documentation (e.g.
README.md
for npm) while also allowing me to change the story it would redirect to later without republishing the module. With the current behaviour I'd need to provide an absolute link and republish my modules to npm when I want to change the story which isn't ideal.To Reproduce
https://github.com/nerdyman/storybook-redirects
pnpm i # Run each SB v6 (:6006) and v7 (:7007). pnpm run -r storybook
System
v6
v7
Additional context
Have checked the docs and asked on Discord but haven't been able to get the redirect working in v7.
The text was updated successfully, but these errors were encountered: