Skip to content

Commit

Permalink
[C-2406] Null check localStorage (#3150)
Browse files Browse the repository at this point in the history
  • Loading branch information
sliptype authored Apr 3, 2023
1 parent 3b31b73 commit 955887f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/web/src/store/storeContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ import { share } from 'utils/share'
import { getLineupSelectorForRoute } from './lineup/lineupForRoute'

export const storeContext: CommonStoreContext = {
getLocalStorageItem: async (key: string) => window.localStorage.getItem(key),
getLocalStorageItem: async (key: string) =>
window?.localStorage?.getItem(key),
setLocalStorageItem: async (key: string, value: string) =>
window.localStorage.setItem(key, value),
window?.localStorage?.setItem(key, value),
// Note: casting return type to Promise<boolean> to maintain pairity with mobile, but
// it may be best to update mobile to not be async
getFeatureEnabled: getFeatureEnabled as unknown as (
Expand Down

0 comments on commit 955887f

Please sign in to comment.