diff --git a/src/components/addresses/AddressPicker.tsx b/src/components/addresses/AddressPicker.tsx index b886d3f..6ac7087 100644 --- a/src/components/addresses/AddressPicker.tsx +++ b/src/components/addresses/AddressPicker.tsx @@ -25,7 +25,7 @@ export function AddressPicker({ walletsOnly, className }: Props): JSX.Element { const { t } = useTranslation(); - const [value, setValue] = useState(""); + const [value, setValue] = useState(""); // Note that the address picker's options are memoised against the wallets // (and soon the address book too), but to save on time and expense, the @@ -37,9 +37,10 @@ // to prepend to the list. Note that the 'exact address' item is NOT shown if // the picker wants wallets only, or if the exact address already appears as a // wallet (or later, an address book entry). - const cleanValue = value.toLowerCase().trim(); + const cleanValue = value?.toLowerCase().trim(); const addressPrefix = useSelector((s: RootState) => s.node.currency.address_prefix); - const hasExactAddress = !walletsOnly + const hasExactAddress = cleanValue + && !walletsOnly && isValidAddress(addressPrefix, cleanValue) && !addressList.includes(cleanValue); const exactAddressItem = hasExactAddress @@ -197,6 +198,8 @@ } } + // TODO: sort the addresses too? + return { categorised, uncategorised, diff --git a/src/krist/wallets/functions/editWallet.ts b/src/krist/wallets/functions/editWallet.ts index f7f25c9..a75ea14 100644 --- a/src/krist/wallets/functions/editWallet.ts +++ b/src/krist/wallets/functions/editWallet.ts @@ -37,8 +37,8 @@ const finalWallet = { ...wallet, - label: updated.label?.trim() || undefined, // clean up empty strings - category: updated.category?.trim() || undefined, + label: updated.label?.trim() || "", + category: updated.category?.trim() || "", address, username: updated.username,