From 162ba7fab7af3aa15a6e46a59b9b1e477dfee3af Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Wed, 19 Apr 2017 22:49:25 +1000 Subject: [PATCH] Render the first story for a kind if no story selected. For #674 --- packages/storybook-ui/src/modules/api/actions/api.js | 1 + packages/storybook-ui/src/modules/ui/configs/handle_routing.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/storybook-ui/src/modules/api/actions/api.js b/packages/storybook-ui/src/modules/api/actions/api.js index ecd7c0727a79..f5bdc0a4aa22 100755 --- a/packages/storybook-ui/src/modules/api/actions/api.js +++ b/packages/storybook-ui/src/modules/api/actions/api.js @@ -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]; } diff --git a/packages/storybook-ui/src/modules/ui/configs/handle_routing.js b/packages/storybook-ui/src/modules/ui/configs/handle_routing.js index 9504af9cdf9f..e77b699b2153 100755 --- a/packages/storybook-ui/src/modules/ui/configs/handle_routing.js +++ b/packages/storybook-ui/src/modules/ui/configs/handle_routing.js @@ -58,7 +58,7 @@ export function updateStore(queryParams, actions) { ...customQueryParams } = queryParams; - if (selectedKind && selectedStory) { + if (selectedKind) { actions.api.selectStory(selectedKind, selectedStory); }