fix: deregister tags component when needed
This commit is contained in:
@@ -209,6 +209,12 @@ class EditorViewCtrl extends PureViewCtrl<{}, EditorState> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$onDestroy() {
|
||||||
|
if (this.state.tagsComponent) {
|
||||||
|
this.application.componentManager!.deregisterComponent(this.state.tagsComponent.uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** @override */
|
/** @override */
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
return {
|
return {
|
||||||
@@ -1058,10 +1064,17 @@ class EditorViewCtrl extends PureViewCtrl<{}, EditorState> {
|
|||||||
const [tagsComponent] =
|
const [tagsComponent] =
|
||||||
this.application.componentManager!.componentsForArea(ComponentArea.NoteTags);
|
this.application.componentManager!.componentsForArea(ComponentArea.NoteTags);
|
||||||
if (tagsComponent?.uuid !== this.state.tagsComponent?.uuid) {
|
if (tagsComponent?.uuid !== this.state.tagsComponent?.uuid) {
|
||||||
this.setState({
|
if (tagsComponent) {
|
||||||
tagsComponent: tagsComponent?.active ? tagsComponent : undefined
|
if (tagsComponent.active) {
|
||||||
});
|
this.application.componentManager!.registerComponent(tagsComponent.uuid);
|
||||||
|
} else {
|
||||||
|
this.application.componentManager!.deregisterComponent(tagsComponent.uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
this.setState({
|
||||||
|
tagsComponent: tagsComponent?.active ? tagsComponent : undefined
|
||||||
|
});
|
||||||
this.application.componentManager!.contextItemDidChangeInArea(ComponentArea.NoteTags);
|
this.application.componentManager!.contextItemDidChangeInArea(ComponentArea.NoteTags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user