fix: race condition on frq when newly logged in

This commit is contained in:
mae taylor 2025-07-23 20:50:49 +01:00
parent 671c45085d
commit 389f8dcaff
Signed by: mae
GPG key ID: 3C80D76BA7A3B9BD

View file

@ -30,7 +30,6 @@
const VERSION = APP_VERSION; const VERSION = APP_VERSION;
const COMMIT = APP_COMMIT; const COMMIT = APP_COMMIT;
const lang = Lang(); const lang = Lang();
const dispatch = createEventDispatcher(); const dispatch = createEventDispatcher();
function gotoProfile() { function gotoProfile() {
@ -63,9 +62,13 @@
goto("/"); goto("/");
} }
onMount(async () => { // fetch follow requests
await fetchFollowRequests(true) let frqsFetched = false;
})
$: if($account && !frqsFetched) {
fetchFollowRequests(true);
frqsFetched = true;
}
</script> </script>
<div id="navigation"> <div id="navigation">
@ -98,7 +101,7 @@
</span> </span>
{/if} {/if}
</Button> </Button>
{#if $followRequests.length > 0} {#if $followRequests && $followRequests.length > 0}
<Button label="{lang.string('navigation.follow_requests')}" <Button label="{lang.string('navigation.follow_requests')}"
href="/follow-requests"} href="/follow-requests"}
active={$page.url.pathname === "/follow-requests"}> active={$page.url.pathname === "/follow-requests"}>