Skip to content

Commit 35a1c49

Browse files
committed
fix: optimize builing list of workspaces (don't build hidden stuff)
1 parent eaace4c commit 35a1c49

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/SpaceMenuItem.vue

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,16 @@
2323
:key="space.id"
2424
:class="'workspace-sidebar '+($route.params.space === spaceName ? 'space-selected' : '')"
2525
:allow-collapse="true"
26-
:open="open()"
26+
:open="open"
2727
:name="spaceName"
28-
:to="{path: getSpacePath()}">
28+
:to="{path: getSpacePath()}"
29+
@update:open="isOpen = $event">
2930
<NcAppNavigationIconBullet slot="icon" :color="space.color" />
3031
<NcCounterBubble slot="counter" class="user-counter">
3132
{{ $store.getters.getSpaceUserCount(spaceName) }}
3233
</NcCounterBubble>
3334
<MenuItemSelector />
35+
<div v-if="isOpen">
3436
<NcAppNavigationCaption
3537
ref="navigationGroup"
3638
:name="t('workspace', 'Workspace groups')">
@@ -79,6 +81,7 @@
7981
:space-name="spaceName"
8082
:count="group.usersCount"
8183
:added-group="true" />
84+
</div>
8285
</NcAppNavigationItem>
8386
</template>
8487

@@ -124,6 +127,7 @@ export default {
124127
},
125128
data() {
126129
return {
130+
isOpen: false,
127131
workspaceGroups: [],
128132
connectedGroups: [],
129133
@@ -132,6 +136,16 @@ export default {
132136
}
133137
},
134138
computed: {
139+
open() {
140+
const id = this.space.id.toString()
141+
return this.$route.params.space === id
142+
},
143+
},
144+
mounted() {
145+
// Open the space menu item if we are in the space route
146+
if (this.open) {
147+
this.isOpen = true
148+
}
135149
},
136150
methods: {
137151
// sorts groups alphabetically
@@ -195,10 +209,6 @@ export default {
195209
return url.substr(url.indexOf('/workspace/'))
196210
},
197211
198-
open() {
199-
const id = this.space.id.toString()
200-
return this.$route.params.space === id
201-
},
202212
},
203213
}
204214
</script>

0 commit comments

Comments
 (0)