Skip to content

Commit

Permalink
perf(task details): better defering
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed Apr 10, 2019
1 parent 4f0286c commit ecd64c4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
18 changes: 12 additions & 6 deletions packages/@vue/cli-ui/src/components/task/ProjectTaskDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@
</VueGroup>
</div>

<div v-if="displayPriority >= 2" class="content">
<div v-if="!defer(3)" class="content placeholder-content">
<div class="view card"/>
</div>

<div v-else class="content">
<TerminalView
ref="terminal"
:class="{
Expand Down Expand Up @@ -133,7 +137,7 @@

<script>
import Prompts from '@/mixins/Prompts'
import DisplayPriority from '@/mixins/DisplayPriority'
import Defer from '@/mixins/Defer'
import TASK from '@/graphql/task/task.gql'
import TASK_LOGS from '@/graphql/task/taskLogs.gql'
Expand All @@ -159,7 +163,7 @@ export default {
field: 'task',
query: TASK
}),
DisplayPriority(2)
Defer()
],
metaInfo () {
Expand Down Expand Up @@ -199,7 +203,7 @@ export default {
}
},
skip () {
return this.displayPriority < 1
return !this.defer(2)
}
},
Expand All @@ -222,7 +226,7 @@ export default {
}
},
skip () {
return this.displayPriority < 2
return !this.defer(3)
}
},
Expand All @@ -242,7 +246,7 @@ export default {
}
},
skip () {
return this.displayPriority < 2
return !this.defer(3)
}
}
}
Expand All @@ -259,6 +263,7 @@ export default {
return id
}
}
return null
}
},
Expand Down Expand Up @@ -370,6 +375,7 @@ export default {
margin 0 $padding-item $padding-item
position relative
.placeholder-content .view,
.terminal-view
position absolute
top 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function (count = 1) {
export default function (count = 10) {
// @vue/component
return {
data () {
Expand All @@ -13,6 +13,7 @@ export default function (count = 1) {

methods: {
runDisplayPriority () {
this.displayPriority = 0
const step = () => {
requestAnimationFrame(() => {
this.displayPriority++
Expand All @@ -22,6 +23,10 @@ export default function (count = 1) {
})
}
step()
},

defer (priority) {
return this.displayPriority >= priority
}
}
}
Expand Down

0 comments on commit ecd64c4

Please sign in to comment.