Skip to content

Commit

Permalink
fix: useProfile
Browse files Browse the repository at this point in the history
  • Loading branch information
2fd committed Mar 25, 2020
1 parent 197fa10 commit c56637a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/hooks/useProfile.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect } from 'react'
import { Profile } from '../utils/auth/types'
import identify, { restoreCurrentProfile, setCurrentProfile, createProfileEffect } from "../utils/auth/identify"
import identify, { restoreCurrentProfile, setCurrentProfile, createProfileEffect, getCurrentProfile } from "../utils/auth/identify"
import usePatchState from './usePatchState'

let CURRENT_PROFILE_LOADER: Promise<Profile | null> | null = null
Expand Down Expand Up @@ -52,7 +52,7 @@ export default function useProfile() {
}

useEffect(() => {
patchState({ loading: false, profile: restoreCurrentProfile() })
patchState({ loading: false, profile: getCurrentProfile() || restoreCurrentProfile() })
return createProfileEffect((event) => patchState({ profile: event.newProfile }))
}, [])

Expand Down

0 comments on commit c56637a

Please sign in to comment.