Compare commits

...

5 Commits

Author SHA1 Message Date
Keyan 153f47de7d
Merge pull request #1480 from stackernews/fix-wallet-logs-infinite-loop
Fix infinite loop of loading wallet logs + center more button
2024-10-18 07:52:03 -05:00
Keyan 6b1f671329
Merge pull request #1483 from stackernews/fix-lnaddr-withdrawals
Fix lnaddr withdrawals
2024-10-18 07:50:45 -05:00
ekzyis ab1104e115 Fix lnaddr withdrawals 2024-10-18 14:19:40 +02:00
ekzyis 70858b97f7 Center more button 2024-10-17 21:22:45 +02:00
ekzyis d91c5c90de Fix infinite loop of loading wallet logs 2024-10-17 21:18:11 +02:00
2 changed files with 7 additions and 6 deletions

View File

@ -131,7 +131,7 @@ export const getBlockHeight = cachedFetcher(async function fetchBlockHeight ({ l
export const getOurPubkey = cachedFetcher(async function fetchOurPubkey ({ lnd, ...args }) {
try {
const { identity } = await getIdentity({ lnd, ...args })
const identity = await getIdentity({ lnd, ...args })
return identity.public_key
} catch (err) {
throw new Error(`Unable to fetch identity: ${err.message}`)

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()
@ -46,7 +43,7 @@ export function WalletLogs ({ wallet, embedded }) {
? <div className='w-100 text-center'>loading...</div>
: logs.length === 0 && <div className='w-100 text-center'>empty</div>}
{hasMore
? <Button onClick={loadMore} size='sm' className='mt-3'>Load More</Button>
? <div className='w-100 text-center'><Button onClick={loadMore} size='sm' className='mt-3'>more</Button></div>
: <div className='w-100 text-center'>------ start of logs ------</div>}
</div>
</>
@ -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 }
}