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

feat: query transactions on networks independently #5528

Merged
merged 7 commits into from
Jun 18, 2024
Merged

Conversation

MuckT
Copy link
Collaborator

@MuckT MuckT commented Jun 10, 2024

Description

Alternative implementation of #5432 which addresses the comments raised in #5432 (comment) passing state and setState to the queryTransactionsFeed function.

Test plan

  • Tested locally on iOS
  • Tested locally on Android
  • Unit tests updated

Related issues

Backwards compatibility

Yes

Network scalability

If a new NetworkId and/or Network are added in the future, the changes in this PR will:

  • Continue to work without code changes, OR trigger a compilation error (guaranteeing we find it when a new network is added)

Copy link

codecov bot commented Jun 10, 2024

Codecov Report

Attention: Patch coverage is 93.10345% with 4 lines in your changes missing coverage. Please review.

Project coverage is 86.46%. Comparing base (8394ddd) to head (f22d0d9).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #5528   +/-   ##
=======================================
  Coverage   86.46%   86.46%           
=======================================
  Files         762      762           
  Lines       31456    31481   +25     
  Branches     5422     5427    +5     
=======================================
+ Hits        27197    27219   +22     
- Misses       4028     4031    +3     
  Partials      231      231           
Files Coverage Δ
src/transactions/feed/queryHelper.ts 93.45% <93.10%> (-1.66%) ⬇️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8394ddd...f22d0d9. Read the comment docs.

Copy link
Member

@jeanregisser jeanregisser left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks for working on this! 🚀

Comment on lines +324 to +326
if (activeRequests[networkId]) {
Logger.info(TAG, `Skipping fetch for ${networkId} as it is already active`)
return
Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering if we could avoid that check and the need to pass setActiveRequests / activeRequests
Is the problem that useAsync can call queryTransactionsFeed multiple times, but we effectively only care about the last one?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added this because some slow networks, such as polygon, take longer than the polling interval to return a result, so we can end up with multiple pending requests that are slow to resolve.

src/transactions/feed/queryHelper.ts Outdated Show resolved Hide resolved
address,
localCurrencyCode,
params: allowedNetworkIds.map((networkId) => {
return { networkId }
}),
updateTransactionState: (networkId, result) => {
Copy link
Member

@jeanregisser jeanregisser Jun 12, 2024

Choose a reason for hiding this comment

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

I wonder if we need to worry that this is handled only for the "current" promise of queryTransactionsFeed.

But maybe since the result is deduplicated it's fine?

Copy link
Collaborator Author

@MuckT MuckT Jun 12, 2024

Choose a reason for hiding this comment

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

We also handle the pending states for polling and pagination separately so it should only fire one request of each type per network.

@MuckT MuckT added this pull request to the merge queue Jun 17, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 17, 2024
@MuckT MuckT added this pull request to the merge queue Jun 17, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 17, 2024
@MuckT MuckT added this pull request to the merge queue Jun 17, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 17, 2024
@MuckT MuckT added this pull request to the merge queue Jun 17, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 17, 2024
@MuckT MuckT added this pull request to the merge queue Jun 17, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 17, 2024
@MuckT MuckT added this pull request to the merge queue Jun 17, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 17, 2024
@MuckT MuckT added this pull request to the merge queue Jun 18, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 18, 2024
@MuckT MuckT added this pull request to the merge queue Jun 18, 2024
@MuckT MuckT removed this pull request from the merge queue due to a manual request Jun 18, 2024
@MuckT MuckT enabled auto-merge June 18, 2024 01:54
@MuckT MuckT added this pull request to the merge queue Jun 18, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 18, 2024
@MuckT MuckT added this pull request to the merge queue Jun 18, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 18, 2024
@MuckT MuckT added this pull request to the merge queue Jun 18, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 18, 2024
@MuckT MuckT added this pull request to the merge queue Jun 18, 2024
Merged via the queue into main with commit f5da2c9 Jun 18, 2024
16 checks passed
@MuckT MuckT deleted the tomm/act-1186-0 branch June 18, 2024 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants