Skip to content

Commit

Permalink
consistently use window.localStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaw3d committed Nov 17, 2022
1 parent 05b3e04 commit 074f850
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/app/state/persist/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const isSyncingTabsSupported = typeof BroadcastChannel === 'function'

export function getInitialState(): PersistState {
return {
hasPersistedProfiles: !!localStorage.getItem(STORAGE_FIELD),
hasPersistedProfiles: !!window.localStorage.getItem(STORAGE_FIELD),
// Disable persistence if tabs would override each other.
isPersistenceUnsupported: needsSyncingTabs && !isSyncingTabsSupported,
loading: false,
Expand Down
4 changes: 2 additions & 2 deletions src/styles/theme/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ export const isSystemDark = window?.matchMedia
: undefined

export function saveTheme(theme: ThemeKeyType) {
window.localStorage && localStorage.setItem('selectedTheme', theme)
window.localStorage.setItem('selectedTheme', theme)
}

/* istanbul ignore next line */
export function getThemeFromStorage(): ThemeKeyType | null {
return window.localStorage ? (localStorage.getItem('selectedTheme') as ThemeKeyType) || null : null
return window.localStorage.getItem('selectedTheme') as ThemeKeyType
}

0 comments on commit 074f850

Please sign in to comment.