Skip to content

Commit

Permalink
πŸ› Default select the first library (if any) for newly created story (#23
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Miles Wong authored and nwingt committed Oct 31, 2017
1 parent e7e43ed commit c38e0ed
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ function getStateFromProps(nextProps, prevProps = {}) {

if (nextProps.open && !prevProps.open) {
const asset = (selectedAssetId ?
assets.find(a => a.id === selectedAssetId) : recentUsedAssets[0]
assets.find(a => a.id === selectedAssetId) :
recentUsedAssets[0]
);
if (libraries && asset) {
state.selectedLibraryIndex = libraries.findIndex(l => (
l.id === asset.libraryId
));
if (libraries) {
state.selectedLibraryIndex = (asset ?
libraries.findIndex(l => l.id === asset.libraryId) :
0 // select the first library by default for new story
);
}
}
return state;
Expand Down

0 comments on commit c38e0ed

Please sign in to comment.