Skip to content

Commit 6a80359

Browse files
committed
A few performance improvements for TreeItem
1 parent c2c8f00 commit 6a80359

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/App.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2525

2626
<script>
2727
import { mapMutations, mapState } from 'vuex'
28+
import Vue from 'vue'
29+
import WhyDidYouRender from './watcher'
30+
31+
Vue.mixin(WhyDidYouRender)
2832
2933
const DEFAULT_LAYOUT = 'empty'
3034

src/components/cylc/tree/TreeItem.vue

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
194194
<!-- component recursion -->
195195
<TreeItem
196196
v-for="child in node.children"
197-
ref="treeitem"
198197
:key="child.id"
199198
:node="child"
200199
:depth="depth + 1"
@@ -205,6 +204,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
205204
v-on:tree-item-expanded="$listeners['tree-item-expanded']"
206205
v-on:tree-item-collapsed="$listeners['tree-item-collapsed']"
207206
v-on:tree-item-clicked="$listeners['tree-item-clicked']"
207+
208208
>
209209
<template v-for="(_, slot) of $scopedSlots" v-slot:[slot]="scope"><slot :name="slot" v-bind="scope"/></template>
210210
</TreeItem>
@@ -249,7 +249,7 @@ export default {
249249
active: false,
250250
selected: false,
251251
isExpanded: this.initialExpanded,
252-
leafProperties: [
252+
leafProperties: Object.freeze([
253253
{
254254
title: 'platform',
255255
property: 'platform'
@@ -274,7 +274,7 @@ export default {
274274
title: 'finish time',
275275
property: 'finishedTime'
276276
}
277-
],
277+
]),
278278
filtered: true
279279
}
280280
},
@@ -284,12 +284,8 @@ export default {
284284
}
285285
},
286286
created () {
287-
// console.log(`TreeItem ${this.node.id} created!`)
288287
this.$emit('tree-item-created', this)
289288
},
290-
updated () {
291-
// console.log(`TreeItem ${this.node.id} updated!`)
292-
},
293289
beforeDestroy () {
294290
this.$emit('tree-item-destroyed', this)
295291
},

0 commit comments

Comments
 (0)