Skip to content

Commit

Permalink
fix(kit): support non-localStorage env for timeline storage, closes #635
Browse files Browse the repository at this point in the history
  • Loading branch information
webfansplz committed Oct 24, 2024
1 parent 9491178 commit aa116d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/devtools-kit/src/core/timeline/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, boolean | string>) {
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,
Expand Down

0 comments on commit aa116d5

Please sign in to comment.