fix selection state indicator on cards not showing up

This commit is contained in:
undergroundwires
2021-01-20 05:30:19 +01:00
parent 2316e3fb68
commit 8b0e47da38

View File

@@ -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) {