From 8b0e47da38c49cfe2645d7d25970c448ecd200f8 Mon Sep 17 00:00:00 2001 From: undergroundwires Date: Wed, 20 Jan 2021 05:30:19 +0100 Subject: [PATCH] fix selection state indicator on cards not showing up --- src/presentation/Scripts/Cards/CardListItem.vue | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/presentation/Scripts/Cards/CardListItem.vue b/src/presentation/Scripts/Cards/CardListItem.vue index 31639a8a..97931f04 100644 --- a/src/presentation/Scripts/Cards/CardListItem.vue +++ b/src/presentation/Scripts/Cards/CardListItem.vue @@ -35,6 +35,7 @@ import { Component, Prop, Watch, Emit } from 'vue-property-decorator'; import ScriptsTree from '@/presentation/Scripts/ScriptsTree/ScriptsTree.vue'; import { StatefulVue } from '@/presentation/StatefulVue'; +import { IEventSubscription } from '@/infrastructure/Events/ISubscription'; @Component({ components: { @@ -49,8 +50,17 @@ export default class CardListItem extends StatefulVue { public isAnyChildSelected = false; public areAllChildrenSelected = false; + private selectionChangedListener: IEventSubscription; + public async mounted() { this.updateStateAsync(this.categoryId); + const context = await this.getCurrentContextAsync(); + this.selectionChangedListener = context.state.selection.changed.on(() => this.updateStateAsync(this.categoryId)); + } + public destroyed() { + if (this.selectionChangedListener) { + this.selectionChangedListener.unsubscribe(); + } } @Emit('selected') public onSelected(isExpanded: boolean) {