| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | import { create } from 'zustand'; |
| 2 | 2 | import { createJSONStorage, devtools, persist } from 'zustand/middleware'; |
| 3 | +import { safeLocalStorage } from './safe-local-storage'; | |
| 3 | 4 | |
| 4 | 5 | const ONE_WEEK_IN_MILLISECONDS = 1000 * 60 * 60 * 24 * 7; |
| 5 | 6 | |
| 6 | 7 | const state = (set, get) => ({ |
| @@ -14,7 +15,7 @@ | ||
| 14 | 15 | |
| 15 | 16 | export const useUnsplashCacheStore = create( |
| 16 | 17 | persist(devtools(state, { name: 'Extendify Unsplash Images' }), { |
| 17 | 18 | name: `extendify-unsplash-images-${window.extSharedData.siteId}`, |
| 18 | - storage: createJSONStorage(() => localStorage), | |
| 19 | + storage: createJSONStorage(() => safeLocalStorage), | |
| 19 | 20 | }), |
| 20 | 21 | ); |