mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-06-17 01:58:33 +02:00
fix: remove circular dependency in loadInitialTransactions
Removed txLoadFailed from the dependency array of loadInitialTransactions callback, which was causing a circular dependency: - loadInitialTransactions depended on txLoadFailed - Function sets txLoadFailed, triggering recreation - New function reference triggers useEffect again - Infinite loop The txLoadAttempted flag in the useEffect is sufficient to prevent repeated loads. No need to check txLoadFailed inside the callback.
This commit is contained in:
@@ -247,9 +247,6 @@ export default function WalletViewer() {
|
||||
}, [getInfo]);
|
||||
|
||||
const loadInitialTransactions = useCallback(async () => {
|
||||
// Prevent repeated attempts if already failed
|
||||
if (txLoadFailed) return;
|
||||
|
||||
setLoading(true);
|
||||
setTxLoadAttempted(true);
|
||||
try {
|
||||
@@ -269,7 +266,7 @@ export default function WalletViewer() {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}, [listTransactions, txLoadFailed]);
|
||||
}, [listTransactions]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isConnected) {
|
||||
|
||||
Reference in New Issue
Block a user