this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix loadAcounts firing twice

+4 -1
+4 -1
src/components/generic-accounts.jsx
··· 1 1 import './generic-accounts.css'; 2 2 3 - import { useEffect, useState } from 'preact/hooks'; 3 + import { useEffect, useRef, useState } from 'preact/hooks'; 4 4 import { InView } from 'react-intersection-observer'; 5 5 import { useSnapshot } from 'valtio'; 6 6 ··· 56 56 })(); 57 57 }; 58 58 59 + const firstLoad = useRef(true); 59 60 useEffect(() => { 60 61 if (staticAccounts?.length > 0) { 61 62 setAccounts(staticAccounts); 62 63 } else { 63 64 loadAccounts(true); 65 + firstLoad.current = false; 64 66 } 65 67 }, [staticAccounts, fetchAccounts]); 66 68 67 69 useEffect(() => { 70 + if (firstLoad.current) return; 68 71 // reloadGenericAccounts contains value like {id: 'mute', counter: 1} 69 72 // We only need to reload if the id matches 70 73 if (snapStates.reloadGenericAccounts?.id === id) {