try again button, user blog tab load, no game text #181

Merged
freakoverse merged 14 commits from staging into master 2025-01-03 11:29:54 +00:00
3 changed files with 20 additions and 6 deletions
Showing only changes of commit ad3d069ad5 - Show all commits

View File

@ -1,11 +1,12 @@
import { RouterProvider } from 'react-router-dom' import { RouterProvider } from 'react-router-dom'
import { useEffect } from 'react' import { useEffect, useMemo } from 'react'
import { routerWithNdkContext } from 'routes' import { routerWithNdkContext as routerWithState } from 'routes'
import { useNDKContext } from 'hooks' import { useNDKContext } from 'hooks'
import './styles/styles.css' import './styles/styles.css'
function App() { function App() {
const ndkContext = useNDKContext() const ndkContext = useNDKContext()
const router = useMemo(() => routerWithState(ndkContext), [ndkContext])
useEffect(() => { useEffect(() => {
// Find the element with id 'root' // Find the element with id 'root'
@ -24,7 +25,7 @@ function App() {
} }
}, []) }, [])
return <RouterProvider router={routerWithNdkContext(ndkContext)} /> return <RouterProvider router={router} />
} }
export default App export default App

View File

@ -44,7 +44,7 @@ export const Layout = () => {
}) })
} }
} }
}, [ndk, dispatch]) }, [dispatch, ndk])
// calculate user's wot // calculate user's wot
useEffect(() => { useEffect(() => {
@ -60,7 +60,7 @@ export const Layout = () => {
toast.error('An error occurred in calculating user web-of-trust!') toast.error('An error occurred in calculating user web-of-trust!')
}) })
} }
}, [ndk, userState.user, dispatch]) }, [dispatch, ndk, userState.user?.pubkey])
// get site's wot level // get site's wot level
useEffect(() => { useEffect(() => {
@ -106,7 +106,7 @@ export const Layout = () => {
}) })
} }
} }
}, [userState.user, dispatch, fetchEventFromUserRelays]) }, [dispatch, fetchEventFromUserRelays, userState.user?.pubkey])
return ( return (
<> <>

View File

@ -274,3 +274,16 @@ export function orderEventsChronologically(
return events return events
} }
/**
* Receives two events and returns the "correct" event to use.
* #nip-33
*/
export default function dedup(event1: NDKEvent, event2: NDKEvent) {
// return the newest of the two
if (event1.created_at! > event2.created_at!) {
return event1
}
return event2
}