Compare commits
No commits in common. "3a0f155010ef6d5acac822f89206659926fa9504" and "7f5fd4534f5c705a52c0f84d3a18c35cca3238ab" have entirely different histories.
3a0f155010
...
7f5fd4534f
@ -39,7 +39,6 @@ export const MainLayout = () => {
|
||||
const [loadingSpinnerDesc, setLoadingSpinnerDesc] = useState(`Loading App`)
|
||||
const isLoggedIn = useAppSelector((state) => state.auth?.loggedIn)
|
||||
const authState = useAppSelector((state) => state.auth)
|
||||
const usersAppData = useAppSelector((state) => state.userAppData)
|
||||
|
||||
// Ref to track if `subscribeForSigits` has been called
|
||||
const hasSubscribed = useRef(false)
|
||||
@ -124,9 +123,6 @@ export const MainLayout = () => {
|
||||
if (opts.type === 'login' || opts.type === 'signup') {
|
||||
dispatch(updateNostrLoginAuthMethod(opts.method))
|
||||
login()
|
||||
} else if (opts.type === 'logout') {
|
||||
// Clear `subscribeForSigits` as called after the logout
|
||||
hasSubscribed.current = false
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,10 +174,12 @@ export const MainLayout = () => {
|
||||
}, [dispatch])
|
||||
|
||||
/**
|
||||
* Subscribe for the sigits
|
||||
* When authState change user logged in / or app reloaded
|
||||
* we set robohash avatar in the global state based on user npub
|
||||
* so that avatar will be consistent across the app when kind 0 is empty
|
||||
*/
|
||||
useEffect(() => {
|
||||
if (authState && isLoggedIn && usersAppData) {
|
||||
if (authState && isLoggedIn) {
|
||||
const pubkey = authState.usersPubkey || authState.keyPair?.public
|
||||
|
||||
if (pubkey && !hasSubscribed.current) {
|
||||
@ -192,17 +190,6 @@ export const MainLayout = () => {
|
||||
// Mark `subscribeForSigits` as called
|
||||
hasSubscribed.current = true
|
||||
}
|
||||
}
|
||||
}, [authState, isLoggedIn, usersAppData])
|
||||
|
||||
/**
|
||||
* When authState change user logged in / or app reloaded
|
||||
* we set robohash avatar in the global state based on user npub
|
||||
* so that avatar will be consistent across the app when kind 0 is empty
|
||||
*/
|
||||
useEffect(() => {
|
||||
if (authState && isLoggedIn) {
|
||||
const pubkey = authState.usersPubkey || authState.keyPair?.public
|
||||
|
||||
if (pubkey) {
|
||||
dispatch(setUserRobotImage(getRoboHashPicture(pubkey)))
|
||||
|
@ -875,10 +875,7 @@ export const subscribeForSigits = async (pubkey: string) => {
|
||||
}
|
||||
|
||||
const processReceivedEvent = async (event: Event, difficulty: number = 5) => {
|
||||
const processedEvents = store.getState().userAppData?.processedGiftWraps
|
||||
|
||||
// Abort processing if userAppData is undefined
|
||||
if (!processedEvents) return
|
||||
const processedEvents = store.getState().userAppData?.processedGiftWraps || []
|
||||
|
||||
if (processedEvents.includes(event.id)) return
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user