Skip to content

Commit c378658

Browse files
author
Guillaume Chau
committed
fix(ui): improved performance
1 parent cfed833 commit c378658

File tree

5 files changed

+41
-19
lines changed

5 files changed

+41
-19
lines changed

packages/@vue/cli-ui-addon-webpack/src/components/WebpackAnalyzer.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ import { size } from '../filters'
118118
import DonutModule from './DonutModule.vue'
119119
120120
export default {
121+
clientState: true,
122+
121123
mixins: [
122124
Dashboard
123125
],

packages/@vue/cli-ui/src/components/ConnectionStatus.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
</ApolloQuery>
2525
</template>
2626

27+
<script>
28+
export default {
29+
clientState: true
30+
}
31+
</script>
32+
2733
<style lang="stylus" scoped>
2834
@import "~@/style/imports"
2935

packages/@vue/cli-ui/src/components/StatusBar.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ import DARK_MODE_SET from '../graphql/darkModeSet.gql'
8383
let lastRoute
8484
8585
export default {
86+
clientState: true,
87+
8688
data () {
8789
return {
8890
showLogs: false,

packages/@vue/cli-ui/src/components/TerminalView.vue

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ const darkTheme = {
7373
}
7474
7575
export default {
76+
clientState: true,
77+
7678
props: {
7779
cols: {
7880
type: Number,
@@ -136,21 +138,12 @@ export default {
136138
137139
content: 'setContent',
138140
139-
theme: {
140-
handler (value) {
141-
if (this.$_terminal) {
142-
this.$_terminal._setTheme(this.theme)
143-
}
144-
},
145-
immediate: true
146-
}
147-
},
148-
149-
mounted () {
150-
this.initTerminal()
151-
152-
if (this.autoSize) {
153-
this.$nextTick(this.fit)
141+
darkMode (value, oldValue) {
142+
if (typeof oldValue === 'undefined') {
143+
this.initTerminal()
144+
} else if (this.$_terminal) {
145+
this.$_terminal._setTheme(this.theme)
146+
}
154147
}
155148
},
156149
@@ -171,6 +164,10 @@ export default {
171164
172165
term.on('blur', () => this.$emit('blur'))
173166
term.on('focus', () => this.$emit('focus'))
167+
168+
if (this.autoSize) {
169+
this.$nextTick(this.fit)
170+
}
174171
},
175172
176173
setContent (value, ln = true) {

packages/@vue/cli-ui/src/mixins/ClientState.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,24 @@ import DARK_MODE from '../graphql/darkMode.gql'
33

44
// @vue/component
55
export default {
6-
apollo: {
7-
// In plugins, user `this.$root.connected` for example
8-
connected: CONNECTED,
9-
darkMode: DARK_MODE
6+
beforeCreate () {
7+
if (this.$options.clientState) {
8+
const newData = {
9+
connected: CONNECTED,
10+
darkMode: DARK_MODE
11+
}
12+
this.$options.apollo = {
13+
...this.$options.apollo,
14+
...newData
15+
}
16+
// Proxy prop on `this`
17+
for (const key in newData) {
18+
Object.defineProperty(this, key, {
19+
get: () => this.$data.$apolloData.data[key],
20+
enumerable: true,
21+
configurable: true
22+
})
23+
}
24+
}
1025
}
1126
}

0 commit comments

Comments
 (0)