Hey is a decentralized and permissionless social media app built with Lens Protocol 🌿

Revert "feat: refresh state after login" (#5839)

authored by yoginth.com and committed by

GitHub 709b98a5 938ca05c

+4 -8
+2 -2
apps/web/src/components/Common/Layout.tsx
··· 14 14 import { Spinner } from "@/components/Shared/UI"; 15 15 import { useTheme } from "@/hooks/useTheme"; 16 16 import { useAccountStore } from "@/store/persisted/useAccountStore"; 17 - import { signOut, useAuthStore } from "@/store/persisted/useAuthStore"; 17 + import { hydrateAuthTokens, signOut } from "@/store/persisted/useAuthStore"; 18 18 import { usePreferencesStore } from "@/store/persisted/usePreferencesStore"; 19 19 import { useProStore } from "@/store/persisted/useProStore"; 20 20 ··· 25 25 const { setProBannerDismissed } = useProStore(); 26 26 const { resetPreferences } = usePreferencesStore(); 27 27 const isMounted = useIsClient(); 28 - const { accessToken } = useAuthStore(); 28 + const { accessToken } = hydrateAuthTokens(); 29 29 30 30 // Disable scroll restoration on route change 31 31 useEffect(() => {
+1 -4
apps/web/src/components/Shared/Auth/Login.tsx
··· 17 17 import Loader from "@/components/Shared/Loader"; 18 18 import { Button, Card, ErrorMessage } from "@/components/Shared/UI"; 19 19 import errorToast from "@/helpers/errorToast"; 20 - import { useAuthModalStore } from "@/store/non-persisted/modal/useAuthModalStore"; 21 20 import { signIn } from "@/store/persisted/useAuthStore"; 22 21 import { EXPANSION_EASE } from "@/variants"; 23 22 import SignupCard from "./SignupCard"; ··· 33 32 null 34 33 ); 35 34 const [isExpanded, setIsExpanded] = useState(true); 36 - const { setShowAuthModal } = useAuthModalStore(); 37 35 38 36 const onError = (error?: any) => { 39 37 setIsSubmitting(false); ··· 116 114 const accessToken = auth.data?.authenticate.accessToken; 117 115 const refreshToken = auth.data?.authenticate.refreshToken; 118 116 signIn({ accessToken, refreshToken }); 119 - setShowAuthModal(false); 120 - return; 117 + return location.reload(); 121 118 } 122 119 123 120 return onError({ message: ERRORS.SomethingWentWrong });
+1 -2
apps/web/src/store/persisted/useAuthStore.ts
··· 15 15 signOut: () => void; 16 16 } 17 17 18 - const { store, useStore: useAuthStore } = createPersistedTrackedStore<State>( 18 + const { store } = createPersistedTrackedStore<State>( 19 19 (set, get) => ({ 20 20 accessToken: null, 21 21 hydrateAuthTokens: () => { ··· 36 36 store.getState().signIn(tokens); 37 37 export const signOut = () => store.getState().signOut(); 38 38 export const hydrateAuthTokens = () => store.getState().hydrateAuthTokens(); 39 - export { useAuthStore };