Skip to content
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 contacts #1735

Merged
merged 2 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .changelog/1735.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix contacts syncing to new tab
6 changes: 4 additions & 2 deletions src/app/pages/AccountPage/Features/SendTransaction/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,11 @@
>
<TextInput
id="recipient-id"
suggestions={contacts.map(contact => contact.name)}
suggestions={contacts.map(contact => ({ label: contact.name, value: contact.address }))}

Check warning on line 88 in src/app/pages/AccountPage/Features/SendTransaction/index.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/pages/AccountPage/Features/SendTransaction/index.tsx#L88

Added line #L88 was not covered by tests
onSuggestionSelect={event =>
setRecipient(contacts.find(contact => contact.name === event.suggestion)?.address || '')
setRecipient(
contacts.find(contact => contact.address === event.suggestion?.value)?.address || '',

Check warning on line 91 in src/app/pages/AccountPage/Features/SendTransaction/index.tsx

View check run for this annotation

Codecov / codecov/patch

src/app/pages/AccountPage/Features/SendTransaction/index.tsx#L90-L91

Added lines #L90 - L91 were not covered by tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's a value in adding contacts with the same names? This can be harmful imo. Shouldn't we block that behavior? cc @donouwens

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyway, if we will need to change behavior I will create ClickUp task. For now I will merge this and make a release just in case we will have a deploy. Thanks Luka!

)
}
name="recipient"
value={recipient}
Expand Down
1 change: 1 addition & 0 deletions src/app/state/persist/syncTabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export function receiveInitialTabSyncState(
...prevState,
theme: initialSyncState.theme,
wallet: initialSyncState.wallet,
contacts: initialSyncState.contacts,
Copy link
Contributor

@buberdds buberdds Oct 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I remember this is covered byPlaywright syncTabs. Why it's not failing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expanded those tests so they would fail #1741

network: initialSyncState.network,
persist: initialSyncState.persist,
}
Expand Down
Loading