-
Notifications
You must be signed in to change notification settings - Fork 97
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(TransactionFeedV2): Fix persisted feed storing unmerged transactions #6205
Changes from all commits
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 |
---|---|---|
|
@@ -29,6 +29,7 @@ import TokenApprovalFeedItem from 'src/transactions/feed/TokenApprovalFeedItem' | |
import TransferFeedItem from 'src/transactions/feed/TransferFeedItem' | ||
import NoActivity from 'src/transactions/NoActivity' | ||
import { allStandbyTransactionsSelector, feedFirstPageSelector } from 'src/transactions/selectors' | ||
import { updateFeedFirstPage } from 'src/transactions/slice' | ||
import { | ||
FeeType, | ||
TokenTransactionTypeV2, | ||
|
@@ -203,7 +204,8 @@ function mergeStandByTransactionsInRange({ | |
return inRange || newTransaction || veryOldTransaction | ||
}) | ||
const deduplicatedTransactions = deduplicateTransactions([...transactions, ...standByInRange]) | ||
const transactionsFromAllowedNetworks = deduplicatedTransactions.filter((tx) => | ||
const sortedTransactions = sortTransactions(deduplicatedTransactions) | ||
const transactionsFromAllowedNetworks = sortedTransactions.filter((tx) => | ||
allowedNetworks.includes(tx.networkId) | ||
) | ||
|
||
|
@@ -427,6 +429,17 @@ export default function TransactionFeedV2() { | |
[newlyCompletedCrossChainSwaps] | ||
) | ||
|
||
useEffect( | ||
function updatePersistedFeedFirstPage() { | ||
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 i understand this change correctly, the difference lies in that we want to store is it possible instead for the 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.
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. @kathaypacific Argh, it seems like if I move this to the selector - I won't be able to pass 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. hum, okay. i don't have a better suggestion but am slightly concerned that these small details are causing some complexity / workarounds that we will later forget about. i can see us potentially reintroducing these bugs during cleanup initiatives. perhaps @jeanregisser has a suggestion here, or leaving a small comment with a link to your comment explanation above is sufficient for now 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. @kathaypacific there are a few potential implementation changes that I have in mind but they involve a bit more time to implement as it will most likely require the overall change of managing |
||
const isFirstPage = !data?.pageInfo.hasPreviousPage | ||
if (isFirstPage) { | ||
const firstPageData = paginatedData[FIRST_PAGE_CURSOR] | ||
dispatch(updateFeedFirstPage({ transactions: firstPageData })) | ||
} | ||
}, | ||
[paginatedData, data?.pageInfo] | ||
) | ||
|
||
const confirmedTransactions = useMemo(() => { | ||
const flattenedPages = Object.values(paginatedData).flat() | ||
const deduplicatedTransactions = deduplicateTransactions(flattenedPages) | ||
|
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.
This was also one of the issues as initial persisted feed appeared unsorted therefore also triggering the rearrangement. It does add up an extra sorting loop, but this shouldn't be a major performance issue for now.