Fix infinite loop of loading wallet logs

This commit is contained in:
ekzyis 2024-10-17 21:14:04 +02:00
parent 1d3ab23ec4
commit d91c5c90de
1 changed files with 5 additions and 4 deletions

View File

@ -12,10 +12,7 @@ import useIndexedDB from './use-indexeddb'
import { SSR } from '@/lib/constants'
export function WalletLogs ({ wallet, embedded }) {
const { logs, setLogs, hasMore, loadMore, loadLogs, loading } = useWalletLogs(wallet)
useEffect(() => {
loadLogs()
}, [loadLogs])
const { logs, setLogs, hasMore, loadMore, loading } = useWalletLogs(wallet)
const showModal = useShowModal()
@ -247,5 +244,9 @@ export function useWalletLogs (wallet, initialPage = 1, logsPerPage = 10) {
setLoading(false)
}, [wallet, loadLogsPage])
useEffect(() => {
loadLogs()
}, [wallet])
return { logs, hasMore, total, loadMore, loadLogs, setLogs, loading }
}