Closed L03TJ3 closed 1 year ago
this looks like some effect - I'd suggest to wrap it onto useEffect with [latest] dep
e.g.
const refreshOrNever = useRefreshOrNever(refresh); const [refreshValue, setRefreshValue] = useState(refreshOrNever); useEffect(() => { // if we connected wallet or did a tx then force a refresh const forceRefresh = latest && latest.type !== "transactionStarted" && latest?.submittedAt > lastNotification.current; if (forceRefresh) { lastNotification.current = latest?.submittedAt; } setRefreshValue(forceRefresh ? 1 : refreshOrNever); }, [refreshOrNever, latest, setRefreshValue]); // in useCalls { refresh: refreshValue }
_Originally posted by @johnsmith-gooddollar in https://github.com/GoodDollar/GoodWeb3-Mono/pull/74#discussion_r1133861076_
e.g.
_Originally posted by @johnsmith-gooddollar in https://github.com/GoodDollar/GoodWeb3-Mono/pull/74#discussion_r1133861076_