mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-04-10 07:27:23 +02:00
fix: make transaction list open by default and fix loading
- Change showTransactions initial state to true (open by default) - Add proper wallet connection checks to useEffect - Ensure transactions load when wallet is connected and supports list_transactions - Add all necessary dependencies to useEffect for reliable loading - Transactions now load automatically when wallet viewer opens
This commit is contained in:
@@ -28,7 +28,7 @@ export default function WalletViewer() {
|
||||
const [copiedPubkey, setCopiedPubkey] = useState(false);
|
||||
const [transactions, setTransactions] = useState<Transaction[]>([]);
|
||||
const [isLoadingTx, setIsLoadingTx] = useState(false);
|
||||
const [showTransactions, setShowTransactions] = useState(false);
|
||||
const [showTransactions, setShowTransactions] = useState(true);
|
||||
|
||||
async function handleRefresh() {
|
||||
setIsRefreshing(true);
|
||||
@@ -80,11 +80,25 @@ export default function WalletViewer() {
|
||||
}
|
||||
}, [supportsTransactions]);
|
||||
|
||||
// Load transactions when wallet is connected and section is expanded
|
||||
useEffect(() => {
|
||||
if (showTransactions && transactions.length === 0) {
|
||||
if (
|
||||
walletState.connected &&
|
||||
supportsTransactions &&
|
||||
showTransactions &&
|
||||
transactions.length === 0 &&
|
||||
!isLoadingTx
|
||||
) {
|
||||
loadTransactions();
|
||||
}
|
||||
}, [showTransactions, transactions.length, loadTransactions]);
|
||||
}, [
|
||||
walletState.connected,
|
||||
supportsTransactions,
|
||||
showTransactions,
|
||||
transactions.length,
|
||||
isLoadingTx,
|
||||
loadTransactions,
|
||||
]);
|
||||
|
||||
if (!walletState.connected || !walletState.info) {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user