diff --git a/src/components/receive/Receive.tsx b/src/components/receive/Receive.tsx index 13a0cd86..bb050731 100644 --- a/src/components/receive/Receive.tsx +++ b/src/components/receive/Receive.tsx @@ -25,13 +25,9 @@ export const Receive = ({ walletFileName }: ReceiveProps) => { const [bitcoinAddress, setBitcoinAddress] = useState() const [copied, setCopied] = useState(false) - const { jars, currency, isPrivate, toggleCurrencyUnit } = useJamDisplayContext() + const { jars, currency, isPrivate, totalBalance, toggleCurrencyUnit } = useJamDisplayContext() const client = useApiClient() - const totalBalance = useMemo(() => { - return jars.reduce((total, jar) => total + (jar.balance || 0), 0) - }, [jars]) - const getAddressQuery = useQuery({ ...getaddressOptions({ client, @@ -117,10 +113,7 @@ export const Receive = ({ walletFileName }: ReceiveProps) => { } useEffect(() => { - const timer = setTimeout(() => { - setCopied(false) - }, 1_500) - + const timer = setTimeout(() => setCopied(false), 1_500) return () => clearTimeout(timer) }, [copied]) diff --git a/src/hooks/useWalletDisplay/index.ts b/src/hooks/useWalletDisplay/index.ts index 3119defe..ffd15422 100644 --- a/src/hooks/useWalletDisplay/index.ts +++ b/src/hooks/useWalletDisplay/index.ts @@ -105,7 +105,7 @@ export function useWalletDisplay(): UseWalletDisplayResult { } }) - const totalBalance = jars.reduce((acc, jar) => acc + jar.balance, 0) + const totalBalance = jars.reduce((acc, jar) => acc + (jar.balance || 0), 0) return { jars, diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json index 7d5dd5c1..bf00b0c8 100644 --- a/src/i18n/locales/en/translation.json +++ b/src/i18n/locales/en/translation.json @@ -414,7 +414,7 @@ "feedback_invalid_amount": "Please provide a valid amount.", "button_new_address": "Get new address", "button_download_qr": "Save QR Code to file", - "text_getting_address": "Getting new address." + "text_getting_address": "Getting new address" }, "earn": { "title": "Earn",