Skip to content

Commit

Permalink
Merge pull request #918 from tmeasday/674-route-first-story
Browse files Browse the repository at this point in the history
Render the first story for a kind if no story selected.
  • Loading branch information
shilman authored Apr 19, 2017
2 parents 53f5f01 + 0455ab5 commit db84165
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/storybook-ui/src/modules/api/actions/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export function ensureStory(storyKinds, selectedKind, selectedStory) {
const found = kindInfo.stories.find(item => item === selectedStory);
if (found) return found;

// if the selected story is non-existant, select the first story
return kindInfo.stories[0];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function updateStore(queryParams, actions) {
...customQueryParams
} = queryParams;

if (selectedKind && selectedStory) {
if (selectedKind) {
actions.api.selectStory(selectedKind, selectedStory);
}

Expand Down

0 comments on commit db84165

Please sign in to comment.