fix: handle retrieving deleted components

This commit is contained in:
Baptiste Grob
2020-07-15 12:21:18 +02:00
parent 9a02dd623b
commit c6a25d6ae4
4 changed files with 68 additions and 124 deletions

View File

@@ -7,7 +7,7 @@ import {
SNTheme,
ComponentArea,
removeFromArray,
ApplicationEvent,
ApplicationEvent
} from 'snjs';
import { AppStateEvent } from '@/ui_models/app_state';
@@ -85,11 +85,11 @@ export class ThemeManager extends ApplicationService {
this.unregisterComponent = this.application!.componentManager!.registerHandler({
identifier: 'themeManager',
areas: [ComponentArea.Themes],
activationHandler: (component) => {
if (component.active) {
activationHandler: (uuid, component) => {
if (component?.active) {
this.activateTheme(component as SNTheme);
} else {
this.deactivateTheme(component.uuid);
this.deactivateTheme(uuid);
}
}
});