mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-05 08:23:35 +00:00
fix consolidate utxo modal infinite rerender loop
This commit is contained in:
1 parent
6fc1df5538
commit
e0031c6b14
1 file changed
+4
-4
@@ -1,8 +1,8 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useState } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { fetchUTXOs, getFeeRates, createBitcoinTransaction, broadcastTransaction, calculateMaxSendAmount, npubToBitcoinAddress, nostrPubkeyToBitcoinAddress, type UTXO } from '@/lib/bitcoin';
|
||||
import type { BitcoinTransaction } from '@/components/wallet/TransactionHistory';
|
||||
import { useToast } from '@/hooks/useToast';
|
||||
import { useToast, toast } from '@/hooks/useToast';
|
||||
import { useQRCode } from '@/hooks/wallet/useQRCode';
|
||||
import { useNsecAccess } from '@/hooks/useNsecAccess';
|
||||
|
||||
@@ -156,7 +156,7 @@ export function useBitcoinOperations(bitcoinAddress: string | null) {
|
||||
const bitcoinMaxAmount = utxos.length > 0 ? calculateMaxSendAmount(utxos, feeRate) : 0;
|
||||
|
||||
// Fetch UTXOs for Bitcoin mode
|
||||
const fetchBitcoinUtxos = async () => {
|
||||
const fetchBitcoinUtxos = useCallback(async () => {
|
||||
if (!bitcoinAddress) return;
|
||||
|
||||
setIsLoadingUtxos(true);
|
||||
@@ -177,7 +177,7 @@ export function useBitcoinOperations(bitcoinAddress: string | null) {
|
||||
} finally {
|
||||
setIsLoadingUtxos(false);
|
||||
}
|
||||
};
|
||||
}, [bitcoinAddress]);
|
||||
|
||||
// Handle Send Max
|
||||
const handleSendMax = (setBitcoinAmount: (amount: string) => void) => {
|
||||
|
||||
Reference in new issue
Block a user