From 5b814ea9befc228bd46fcacddbc86da26466e6f9 Mon Sep 17 00:00:00 2001 From: Baptiste Grob <60621355+baptiste-grob@users.noreply.github.com> Date: Fri, 16 Oct 2020 11:59:44 +0200 Subject: [PATCH] fix: prevent errors when destroying local data on launch challenge --- app/assets/javascripts/services/autolock_service.ts | 4 ++-- app/assets/javascripts/views/editor/editor_view.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/services/autolock_service.ts b/app/assets/javascripts/services/autolock_service.ts index fc1692ad0..544296bdd 100644 --- a/app/assets/javascripts/services/autolock_service.ts +++ b/app/assets/javascripts/services/autolock_service.ts @@ -15,7 +15,7 @@ const STORAGE_KEY_AUTOLOCK_INTERVAL = "AutoLockIntervalKey"; export class AutolockService extends ApplicationService { - private unsubState: any + private unsubState?: () => void; private pollFocusInterval: any private lastFocusState?: 'hidden' | 'visible' private lockAfterDate?: Date @@ -42,7 +42,7 @@ export class AutolockService extends ApplicationService { } deinit() { - this.unsubState(); + this.unsubState?.(); this.cancelAutoLockTimer(); if (this.pollFocusInterval) { clearInterval(this.pollFocusInterval); diff --git a/app/assets/javascripts/views/editor/editor_view.ts b/app/assets/javascripts/views/editor/editor_view.ts index 131562893..7ad055864 100644 --- a/app/assets/javascripts/views/editor/editor_view.ts +++ b/app/assets/javascripts/views/editor/editor_view.ts @@ -923,8 +923,8 @@ class EditorViewCtrl extends PureViewCtrl<{}, EditorState> { if ( this.state.marginResizersEnabled && - this.leftPanelPuppet!.ready && - this.rightPanelPuppet!.ready + this.leftPanelPuppet?.ready && + this.rightPanelPuppet?.ready ) { const width = this.application.getPrefsService().getValue( WebPrefKey.EditorWidth,