From aa116d5ca53f3ed0fe7479a5b24c9628aaf0716f Mon Sep 17 00:00:00 2001 From: arlo Date: Thu, 24 Oct 2024 21:08:18 +0800 Subject: [PATCH] fix(kit): support non-localStorage env for timeline storage, closes #635 --- packages/devtools-kit/src/core/timeline/storage.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/devtools-kit/src/core/timeline/storage.ts b/packages/devtools-kit/src/core/timeline/storage.ts index 4fb363d56..f1ec4fd31 100644 --- a/packages/devtools-kit/src/core/timeline/storage.ts +++ b/packages/devtools-kit/src/core/timeline/storage.ts @@ -3,14 +3,14 @@ import { isBrowser } from '@vue/devtools-shared' const TIMELINE_LAYERS_STATE_STORAGE_ID = '__VUE_DEVTOOLS_KIT_TIMELINE_LAYERS_STATE__' export function addTimelineLayersStateToStorage(state: Record) { - if (!isBrowser || typeof localStorage === 'undefined') { + if (!isBrowser || typeof localStorage === 'undefined' || localStorage === null) { return } localStorage.setItem(TIMELINE_LAYERS_STATE_STORAGE_ID, JSON.stringify(state)) } export function getTimelineLayersStateFromStorage() { - if (!isBrowser || typeof localStorage === 'undefined') { + if (!isBrowser || typeof localStorage === 'undefined' || localStorage === null) { return { recordingState: false, mouseEventEnabled: false,