Merge pull request #392 from standardnotes/fix-lingering-component-actions

Fix component actions still running after destruction
This commit is contained in:
Mo Bitar
2020-03-19 12:21:56 -05:00
committed by GitHub

View File

@@ -24,6 +24,7 @@ class ComponentViewCtrl {
this.desktopManager = desktopManager;
this.componentManager = componentManager;
this.componentValid = true;
this.destroyed = false;
$scope.$watch('ctrl.component', (component, prevComponent) => {
this.componentValueDidSet(component, prevComponent);
@@ -32,6 +33,7 @@ class ComponentViewCtrl {
this.reloadStatus(false);
});
$scope.$on('$destroy', () => {
this.destroyed = true;
this.destroy();
});
}
@@ -92,6 +94,7 @@ class ComponentViewCtrl {
async reloadComponent() {
this.componentValid = false;
await this.componentManager.reloadComponent(this.component);
if (this.destroyed) return;
this.reloadStatus();
}