all repos — caroster @ 39fd63e38e2eea8a7945a6ea37cca60f0a1896cc

[Octree] Group carpool to your event https://caroster.io

fix: 🩹 Fix persistent store
Tim Izzo tim@octree.ch
Thu, 29 Sep 2022 13:48:46 +0200
commit

39fd63e38e2eea8a7945a6ea37cca60f0a1896cc

parent

ab8a41da0d4ed69e49cd079c63b765d39d393dbd

M frontend/stores/useOnboardingStore.tsfrontend/stores/useOnboardingStore.ts

@@ -9,7 +9,7 @@ type State = OnBoarding & {

setOnboarding: (onboarding: Partial<OnBoarding>) => void; }; -const useOnboardingStore = create<State>( +const useOnboardingStore = create<State>()( persist( set => ({ onboardingUser: false,
M frontend/stores/useRedirectUrl.tsfrontend/stores/useRedirectUrl.ts

@@ -7,16 +7,21 @@ setRedirectUrl: (redirectUrl: string) => void;

getRedirectUrl: () => string; }; -const useRedirectUrlStore = create<State>( - persist((set, get) => ({ - redirectUrl: null, - setRedirectUrl: redirectUrl => set({redirectUrl}), - getRedirectUrl: () => { - const redirectUrl = get().redirectUrl; - set({redirectUrl: null}); - return redirectUrl; - }, - })) +const useRedirectUrlStore = create<State>()( + persist( + (set, get) => ({ + redirectUrl: null, + setRedirectUrl: redirectUrl => set({redirectUrl}), + getRedirectUrl: () => { + const redirectUrl = get().redirectUrl; + set({redirectUrl: null}); + return redirectUrl; + }, + }), + { + name: 'REDIRECT_URL_STORE', + } + ) ); export default useRedirectUrlStore;
M frontend/stores/useTourStore.tsfrontend/stores/useTourStore.ts

@@ -12,11 +12,6 @@ type State = Tour & {

setTour: (tour: Partial<Tour>) => void; }; -const ONBOARDING_STORAGE_KEY = 'showWelcome'; -let persistedShowWelcome = null; -if(typeof localStorage !== 'undefined') - persistedShowWelcome = JSON.parse(localStorage.getItem(ONBOARDING_STORAGE_KEY)); - const useTourStore = create<State>(set => ({ showWelcome: false, isCreator: null,