Skip to content

Commit

Permalink
Ensure we don't re-route to the same URL when we are using a specifier.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeasday committed Aug 3, 2020
1 parent b1bd420 commit e91dd0e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/api/src/modules/stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,12 @@ export const init: ModuleFn = ({
if (fullAPI.isSettingsScreenActive()) return;

if (sourceType === 'local') {
navigate(`/${viewMode}/${storyId}`);
// Special case -- if we are already at the story being specified (i.e. the user started at a given story),
// we don't need to change URL. See https://github.com/storybookjs/storybook/issues/11677
const state = store.getState();
if (state.storyId !== storyId || state.viewMode !== viewMode) {
navigate(`/${viewMode}/${storyId}`);
}
}
});

Expand Down

0 comments on commit e91dd0e

Please sign in to comment.