From 97a493c218944b80afd278eaf5e42bbe19150a53 Mon Sep 17 00:00:00 2001 From: Chad Curtis Date: Mon, 14 Jul 2025 14:21:57 +0000 Subject: [PATCH] fix redraw issue for wallet configuration --- src/components/WalletModal.tsx | 505 +++++++++++++++++++-------------- src/components/ZapDialog.tsx | 2 - src/hooks/useNWC.ts | 2 +- 3 files changed, 288 insertions(+), 221 deletions(-) diff --git a/src/components/WalletModal.tsx b/src/components/WalletModal.tsx index c5fd8b2..7643ea5 100644 --- a/src/components/WalletModal.tsx +++ b/src/components/WalletModal.tsx @@ -1,4 +1,4 @@ -import { useState } from 'react'; +import { useState, forwardRef } from 'react'; import { Wallet, Plus, Trash2, Zap, Globe, WalletMinimal, CheckCircle, X } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { @@ -28,12 +28,183 @@ import { useNWC } from '@/hooks/useNWCContext'; import { useWallet } from '@/hooks/useWallet'; import { useToast } from '@/hooks/useToast'; import { useIsMobile } from '@/hooks/useIsMobile'; +import type { NWCConnection, NWCInfo } from '@/hooks/useNWC'; interface WalletModalProps { children?: React.ReactNode; className?: string; } +// Extracted AddWalletContent to prevent re-renders +const AddWalletContent = forwardRef void; + connectionUri: string; + setConnectionUri: (value: string) => void; +}>(({ alias, setAlias, connectionUri, setConnectionUri }, ref) => ( +
+
+ + setAlias(e.target.value)} + /> +
+
+ +