-
Notifications
You must be signed in to change notification settings - Fork 360
Filter the AddressBook sorted entries before displaying them #3014
Conversation
|
CLA Assistant Lite All Contributors have signed the CLA. |
|
The bug seems to occur if the user had old data (don't know how old) in the Address Book and on exporting and importing it would create duplicated entries. I was not able to reproduce it locally but open the PR to validate my solution and to share the deployments with the QA to see if it resolves the problem. |
ESLint Summary View Full Report
Report generated by eslint-plus-action |
|
Pull Request Test Coverage Report for Build 1471733840
💛 - Coveralls |
|
E2E Tests Passed ✅ |
|
IMO it's not worth it fixing it like this. We should fix the import. |
Fair enough. The import is working as expected, as it also overrides the duplicated entries https://github.com/gnosis/safe-react/blob/434fa9f45dd586403866cd3096b1280f387621ae/src/logic/addressBook/store/reducer/index.ts#L19-L30 It is very inefficient trying to fix this bug without actually being able to reproduce the faulty behavior. |
|
@liliya-soroka can you share the content of your LS with the dupes? |
|
Does @liliya-soroka's csv file have duplicates in it, or is it a purely visual based bug? |
The |
f10ff8e to
6c53631
Compare
src/logic/addressBook/utils/index.ts
Outdated
| try { | ||
| hasSameChecksumAddress = checksumAddress(address) === checksumAddress(addressBookEntry.address) | ||
| } catch (e) { | ||
| console.error(e) |
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.
We don't use console.error. I would just return false here.
|
I was able to reproduce the bug by making Used that data with duplicates to implement a filter before we return the reducer state so old duplicates are filtered out. |
iamacook
left a comment
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.
Looks good to me!
Deployment links
|
|
So I didn't have issues by importing csv with repeated entries, but I also didn't had issues back in prod when this issue was reported. @liliya-soroka You describe a way to reproduce it by using the mobile app. I'd like to see if that can be tried in this PR and verify if this works. |
|
@francovenica you could test by lowercasing all the addresses in your CSV. |
|
Ok, tried by having a csv with the same entry 3 times, one checksummed, and the other 2 with upper and lower case characters. Looks good to me |
What it solves
Resolves #2965
How this PR fixes it
On searching for an existing AB entry we compare now the addresses checksum.
Before updating the Redux store we filter out AB entries with same address and chainId
How to test it
On any conditions, exporting and importing your address book should not generate any duplicated entries in the "Address Book"
Screenshots