From f20212cb82b7f2c64c0053efdeae8acae64fc93d Mon Sep 17 00:00:00 2001 From: Collin Brown Date: Fri, 11 Sep 2020 17:25:33 -0400 Subject: [PATCH] Moving sidebar items to computed isntead of data Reason is that data is not inherently reactive, but computed is When locale changes, the items will be updated correctly in computed --- .../components/organisms/layout/TheSideBar.vue | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/frontend/components/organisms/layout/TheSideBar.vue b/frontend/components/organisms/layout/TheSideBar.vue index c6badaae..9992d080 100644 --- a/frontend/components/organisms/layout/TheSideBar.vue +++ b/frontend/components/organisms/layout/TheSideBar.vue @@ -53,8 +53,14 @@ export default { data() { return { - selected: 0, - items: [ + selected: 0 + } + }, + + computed: { + ...mapGetters('projects', ['loadSearchOptions']), + filteredItems() { + const items = [ { icon: 'mdi-home', text: this.$t('projectHome.home'), link: '', adminOnly: false }, { icon: 'mdi-database', text: this.$t('dataset.dataset'), link: 'dataset', adminOnly: true }, { icon: 'label', text: this.$t('labels.labels'), link: 'labels', adminOnly: true }, @@ -62,13 +68,7 @@ export default { { icon: 'mdi-book-open-outline', text: this.$t('guideline.guideline'), link: 'guideline', adminOnly: true }, { icon: 'mdi-chart-bar', text: this.$t('statistics.statistics'), link: 'statistics', adminOnly: true } ] - } - }, - - computed: { - ...mapGetters('projects', ['loadSearchOptions']), - filteredItems() { - return this.items.filter(item => this.isVisible(item)) + return items.filter(item => this.isVisible(item)) } },