try again button, user blog tab load, no game text #181
@ -1,11 +1,12 @@
|
||||
import { RouterProvider } from 'react-router-dom'
|
||||
import { useEffect } from 'react'
|
||||
import { routerWithNdkContext } from 'routes'
|
||||
import { useEffect, useMemo } from 'react'
|
||||
import { routerWithNdkContext as routerWithState } from 'routes'
|
||||
import { useNDKContext } from 'hooks'
|
||||
import './styles/styles.css'
|
||||
|
||||
function App() {
|
||||
const ndkContext = useNDKContext()
|
||||
const router = useMemo(() => routerWithState(ndkContext), [ndkContext])
|
||||
|
||||
useEffect(() => {
|
||||
// Find the element with id 'root'
|
||||
@ -24,7 +25,7 @@ function App() {
|
||||
}
|
||||
}, [])
|
||||
|
||||
return <RouterProvider router={routerWithNdkContext(ndkContext)} />
|
||||
return <RouterProvider router={router} />
|
||||
}
|
||||
|
||||
export default App
|
||||
|
@ -44,7 +44,7 @@ export const Layout = () => {
|
||||
})
|
||||
}
|
||||
}
|
||||
}, [ndk, dispatch])
|
||||
}, [dispatch, ndk])
|
||||
|
||||
// calculate user's wot
|
||||
useEffect(() => {
|
||||
@ -60,7 +60,7 @@ export const Layout = () => {
|
||||
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
|
||||
useEffect(() => {
|
||||
@ -106,7 +106,7 @@ export const Layout = () => {
|
||||
})
|
||||
}
|
||||
}
|
||||
}, [userState.user, dispatch, fetchEventFromUserRelays])
|
||||
}, [dispatch, fetchEventFromUserRelays, userState.user?.pubkey])
|
||||
|
||||
return (
|
||||
<>
|
||||
|
@ -274,3 +274,16 @@ export function orderEventsChronologically(
|
||||
|
||||
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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user