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

Bug fix/sync import time #2554

Merged
merged 4 commits into from
Apr 20, 2021
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
12 changes: 4 additions & 8 deletions app/components/Views/Asset/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,10 @@ class Asset extends PureComponent {
const confirmedTxs = [];
const { chainId, transactions } = this.props;
if (transactions.length) {
transactions.sort((a, b) => (a.time > b.time ? -1 : b.time > a.time ? 1 : 0));
const txs = transactions.filter(tx => {
const filerResult = this.filter(tx);
if (filerResult) {
const filterResult = this.filter(tx);
if (filterResult) {
tx.insertImportTime = addAccountTimeFlagFilter(
tx,
addedAccountTime,
Expand All @@ -210,13 +211,9 @@ class Asset extends PureComponent {
break;
}
}
return filerResult;
return filterResult;
});

txs.sort((a, b) => (a.time > b.time ? -1 : b.time > a.time ? 1 : 0));
submittedTxs.sort((a, b) => (a.time > b.time ? -1 : b.time > a.time ? 1 : 0));
confirmedTxs.sort((a, b) => (a.time > b.time ? -1 : b.time > a.time ? 1 : 0));

const submittedNonces = [];
submittedTxs = submittedTxs.filter(transaction => {
const alreadySubmitted = submittedNonces.includes(transaction.transaction.nonce);
Expand All @@ -228,7 +225,6 @@ class Asset extends PureComponent {
if (!accountAddedTimeInsertPointFound && txs && txs.length) {
txs[txs.length - 1].insertImportTime = true;
}

// To avoid extra re-renders we want to set the new txs only when
// there's a new tx in the history or the status of one of the existing txs changed
if (
Expand Down
1 change: 1 addition & 0 deletions app/core/Engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ class Engine {
const checksummedAddress = toChecksumAddress(address);
if (accounts.hd.includes(checksummedAddress) || accounts.simpleKeyPair.includes(checksummedAddress)) {
updatedPref.identities[checksummedAddress] = preferences.identities[address];
updatedPref.identities[checksummedAddress].importTime = Date.now();
}
});
await PreferencesController.update(updatedPref);
Expand Down