Fix component reloading after destruction
This commit is contained in:
@@ -24,6 +24,7 @@ class ComponentViewCtrl {
|
|||||||
this.desktopManager = desktopManager;
|
this.desktopManager = desktopManager;
|
||||||
this.componentManager = componentManager;
|
this.componentManager = componentManager;
|
||||||
this.componentValid = true;
|
this.componentValid = true;
|
||||||
|
this.destroyed = false;
|
||||||
|
|
||||||
$scope.$watch('ctrl.component', (component, prevComponent) => {
|
$scope.$watch('ctrl.component', (component, prevComponent) => {
|
||||||
this.componentValueDidSet(component, prevComponent);
|
this.componentValueDidSet(component, prevComponent);
|
||||||
@@ -32,6 +33,7 @@ class ComponentViewCtrl {
|
|||||||
this.reloadStatus(false);
|
this.reloadStatus(false);
|
||||||
});
|
});
|
||||||
$scope.$on('$destroy', () => {
|
$scope.$on('$destroy', () => {
|
||||||
|
this.destroyed = true;
|
||||||
this.destroy();
|
this.destroy();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -92,6 +94,7 @@ class ComponentViewCtrl {
|
|||||||
async reloadComponent() {
|
async reloadComponent() {
|
||||||
this.componentValid = false;
|
this.componentValid = false;
|
||||||
await this.componentManager.reloadComponent(this.component);
|
await this.componentManager.reloadComponent(this.component);
|
||||||
|
if (this.destroyed) return;
|
||||||
this.reloadStatus();
|
this.reloadStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user