Skip to content

Commit

Permalink
fix(ui): various bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed Apr 26, 2018
1 parent a8c441c commit acd4ab4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
</svg>
</template>

<div class="described-module">
<div v-if="describedModule" class="described-module">
<div class="wrapper">
<div class="path" v-html="modulePath"/>
<div
Expand Down Expand Up @@ -137,6 +137,7 @@ export default {
},
modulePath () {
if (!this.describedModule) return
let path = `<b>${this.describedModule.id}</b>`
let module = this.describedModule
while (module.parent && module !== this.currentTree) {
Expand All @@ -154,12 +155,22 @@ export default {
watch: {
modulesTrees: {
handler (value) {
if (!this.selectedChunk && value) {
if (value) {
const keys = Object.keys(value)
if (keys.length) {
this.selectedChunk = keys[0]
if (!this.selectedChunk || !keys.includes(this.selectedChunk)) {
if (keys.length) {
this.selectedChunk = keys[0]
}
}
this.goToHome()
return
}
}
// Clear
this.currentTree = null
this.selectedChunk = null
},
immediate: true
},
Expand Down
22 changes: 12 additions & 10 deletions packages/@vue/cli-ui/src/graphql-api/connectors/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const cwd = require('./cwd')
const folders = require('./folders')
const prompts = require('./prompts')
const progress = require('./progress')
const projects = require('./projects')
const logs = require('./logs')
const clientAddons = require('./client-addons')
const views = require('./views')
Expand Down Expand Up @@ -96,15 +95,18 @@ function resetPluginApi (context) {
// Add views
pluginApi.views.forEach(view => views.add(view, context))

const project = projects.getCurrent(context)
if (!project) return
if (projectId !== project.id) {
projectId = project.id
pluginApi.projectOpenHooks.forEach(fn => fn(project, projects.getLast(context)))
pluginApi.project = project
} else {
pluginApi.pluginReloadHooks.forEach(fn => fn(project))
}
setTimeout(() => {
const projects = require('./projects')
const project = projects.getCurrent(context)
if (!project) return
if (projectId !== project.id) {
projectId = project.id
pluginApi.projectOpenHooks.forEach(fn => fn(project, projects.getLast(context)))
pluginApi.project = project
} else {
pluginApi.pluginReloadHooks.forEach(fn => fn(project))
}
})
}

function runPluginApi (id, context, fileName = 'ui') {
Expand Down
2 changes: 1 addition & 1 deletion packages/@vue/cli-ui/src/views/ProjectTaskDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export default {
},
fetchPolicy: 'cache-and-network',
async result ({ data, loading }) {
if (!this.$_init && !loading && data && data.task.defaultView) {
if (!this.$_init && !loading && data && data.task && data.task.defaultView) {
this.$_init = true
await this.$nextTick()
this.currentView = data.task.defaultView
Expand Down

0 comments on commit acd4ab4

Please sign in to comment.