Skip to content

Commit

Permalink
Render the first story for a kind if no story selected.
Browse files Browse the repository at this point in the history
For #674
  • Loading branch information
tmeasday authored and ndelangen committed May 24, 2017
1 parent 5b0776e commit 162ba7f
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 162ba7f

Please sign in to comment.