Fix infinitely subscribing to state changes

This commit is contained in:
undergroundwires
2021-08-23 17:38:14 +01:00
parent f2935e4008
commit ea5f9ec27d

View File

@@ -72,13 +72,11 @@ export default class TheSelector extends StatefulVue {
this.selectionTypeHandler.selectType(type);
}
protected handleCollectionState(newState: ICategoryCollectionState, oldState: ICategoryCollectionState): void {
protected handleCollectionState(newState: ICategoryCollectionState): void {
this.events.unsubscribeAll();
this.selectionTypeHandler = new SelectionTypeHandler(newState);
this.updateSelections();
newState.selection.changed.on(() => this.updateSelections());
if (oldState) {
oldState.selection.changed.on(() => this.updateSelections());
}
this.events.register(newState.selection.changed.on(() => this.updateSelections()));
}
private updateSelections() {