-
Notifications
You must be signed in to change notification settings - Fork 635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix send sheet stuck on loading #6119
Changes from all commits
a4b2f42
3fa0b3e
8cee9c6
fe9505c
3f36f90
1ac6cb7
21a4c76
7adfdc8
4b943f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,17 +117,15 @@ export default function SendHeader({ | |
const isPreExistingContact = (contact?.nickname?.length || 0) > 0; | ||
|
||
const name = | ||
removeFirstEmojiFromString(userWallet?.label || contact?.nickname || nickname) || userWallet?.ens || contact?.ens || recipient; | ||
removeFirstEmojiFromString(contact?.nickname || userWallet?.label || nickname) || userWallet?.ens || contact?.ens || recipient; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if you assigned a nickname to a contact it was never for wallets that had ENS names |
||
|
||
const handleNavigateToContact = useCallback(() => { | ||
let nickname = profilesEnabled ? (!isHexString(recipient) ? recipient : null) : recipient; | ||
let color = ''; | ||
const nickname = !isHexString(name) ? name : ''; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we only want nicknames prefilled for ENS related names. |
||
if (!profilesEnabled) { | ||
color = contact?.color; | ||
if (color !== 0 && !color) { | ||
const emoji = profileUtils.addressHashedEmoji(hexAddress); | ||
color = profileUtils.addressHashedColorIndex(hexAddress) || 0; | ||
nickname = isHexString(recipient) ? emoji : `${emoji} ${recipient}`; | ||
} | ||
} | ||
|
||
|
@@ -142,7 +140,7 @@ export default function SendHeader({ | |
onRefocusInput, | ||
type: 'contact_profile', | ||
}); | ||
}, [contact, hexAddress, navigate, onRefocusInput, profilesEnabled, recipient]); | ||
}, [contact, hexAddress, name, navigate, onRefocusInput, profilesEnabled, recipient]); | ||
|
||
const handleOpenContactActionSheet = useCallback(async () => { | ||
return showActionSheetWithOptions( | ||
|
@@ -162,7 +160,7 @@ export default function SendHeader({ | |
address: hexAddress, | ||
nickname: name, | ||
onDelete: () => { | ||
onChangeAddressInput(contact?.ens); | ||
onChangeAddressInput(contact?.ens ? contact?.ens : contact?.address); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. okay so basically this was triggering a |
||
}, | ||
removeContact: removeContact, | ||
}); | ||
|
@@ -175,7 +173,17 @@ export default function SendHeader({ | |
} | ||
} | ||
); | ||
}, [contact?.ens, handleNavigateToContact, hexAddress, onRefocusInput, removeContact, setClipboard, name, onChangeAddressInput]); | ||
}, [ | ||
hexAddress, | ||
name, | ||
removeContact, | ||
onChangeAddressInput, | ||
contact?.ens, | ||
contact?.address, | ||
handleNavigateToContact, | ||
onRefocusInput, | ||
setClipboard, | ||
]); | ||
|
||
const onChange = useCallback( | ||
text => { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -420,7 +420,7 @@ export const SendConfirmationSheet = () => { | |
return existingAcct; | ||
}, [toAddress, userAccounts, watchedAccounts]); | ||
|
||
let avatarName = removeFirstEmojiFromString(existingAccount?.label || contact?.nickname); | ||
let avatarName = removeFirstEmojiFromString(contact?.nickname || existingAccount?.label); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay similarly to the other instance of this, we were never showing contact nicknames for accounts with ens names since we always preferred ens names over contact nicknames. |
||
|
||
if (!avatarName) { | ||
if (isValidDomainFormat(to)) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -588,7 +588,7 @@ export default function SendSheet(props) { | |
})(); | ||
} | ||
}, | ||
[amountDetails.assetAmount, goBack, isENS, isHardwareWallet, navigate, onSubmit, recipient, selected?.name, selected?.network] | ||
[amountDetails, goBack, isENS, isHardwareWallet, navigate, onSubmit, recipient, selected?.name, selected?.network] | ||
); | ||
|
||
const { buttonDisabled, buttonLabel } = useMemo(() => { | ||
|
@@ -713,8 +713,8 @@ export default function SendSheet(props) { | |
const isValid = checkIsValidAddressOrDomainFormat(text); | ||
if (!isValid) { | ||
setIsValidAddress(); | ||
setToAddress(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should only reset the toAddress here if it's not valid. |
||
} | ||
setToAddress(); | ||
setCurrentInput(text); | ||
setRecipient(text); | ||
setNickname(text); | ||
|
@@ -764,7 +764,6 @@ export default function SendSheet(props) { | |
|
||
if ( | ||
!!accountAddress && | ||
amountDetails.assetAmount !== '' && | ||
Object.entries(selected).length && | ||
assetChainId === currentChainId && | ||
currentProviderChainId === currentChainId && | ||
|
@@ -813,6 +812,12 @@ export default function SendSheet(props) { | |
|
||
const isEmptyWallet = !sortedAssets?.length && !sendableUniqueTokens?.length; | ||
|
||
const filteredUserAccountsFromContacts = useMemo(() => { | ||
return userAccounts.filter( | ||
account => !filteredContacts.some(contact => contact.address.toLowerCase() === account.address.toLowerCase()) | ||
); | ||
}, [userAccounts, filteredContacts]); | ||
|
||
Comment on lines
+815
to
+820
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixes not showing the account in the user wallets list if it exists in the contacts list |
||
return ( | ||
<Container testID="send-sheet"> | ||
<SheetContainer> | ||
|
@@ -832,7 +837,7 @@ export default function SendSheet(props) { | |
recipientFieldRef={recipientFieldRef} | ||
removeContact={onRemoveContact} | ||
showAssetList={showAssetList} | ||
userAccounts={userAccounts} | ||
userAccounts={filteredUserAccountsFromContacts} | ||
watchedAccounts={watchedAccounts} | ||
/> | ||
{showEmptyState && ( | ||
|
@@ -848,7 +853,7 @@ export default function SendSheet(props) { | |
setNickname(nickname); | ||
}} | ||
removeContact={onRemoveContact} | ||
userAccounts={userAccounts} | ||
userAccounts={filteredUserAccountsFromContacts} | ||
watchedAccounts={watchedAccounts} | ||
/> | ||
)} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for L2s this was overflowing onto the next line for Android so that's why I made this change for context. Not a super good fix but it's a patch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this is somehow affecting iOS. Maybe safer to wrap in a platform check and keep ios the same?