Protect against other exit methods, protect against multiple fetches

This commit is contained in:
Eric Bailey
2024-09-11 21:56:20 -05:00
parent 45c8d89d92
commit c99e43d6c6
2 changed files with 16 additions and 13 deletions
@@ -87,6 +87,7 @@ export function TenMillion() {
const agent = useAgent()
const nuxDialogs = useNuxDialogContext()
const [userNumber, setUserNumber] = React.useState<number>(0)
const fetching = React.useRef(false)
React.useEffect(() => {
async function fetchUserNumber() {
@@ -119,9 +120,12 @@ export function TenMillion() {
}
}
networkRetry(3, fetchUserNumber).catch(() => {
nuxDialogs.dismissActiveNux()
})
if (!fetching.current) {
fetching.current = true
networkRetry(3, fetchUserNumber).catch(() => {
nuxDialogs.dismissActiveNux()
})
}
}, [
agent.sessionManager.pdsUrl,
agent.session?.accessJwt,