Skip to content

Commit

Permalink
fix(ui): unhandled auto project open error
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed May 3, 2018
1 parent 8992e7b commit 5b232f9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/@vue/cli-ui/src/graphql-api/connectors/projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ async function open (id, context) {
}).value()

if (!project) {
console.warn(`Project '${id}' not found`)
log('Project not found', id)
return null
}

Expand Down Expand Up @@ -359,14 +359,20 @@ function setFavorite ({ id, favorite }, context) {
}

// Open last project
{
async function autoOpenLastProject () {
const context = getContext(null)
const id = context.db.get('config.lastOpenProject').value()
if (id) {
open(id, context)
try {
await open(id, context)
} catch (e) {
log(`Project can't be auto-opened`, id)
}
}
}

autoOpenLastProject()

module.exports = {
list,
getCurrent,
Expand Down

0 comments on commit 5b232f9

Please sign in to comment.