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

chore(TransactionFeedV2): Add "No more transactions" toast #6153

Merged
merged 12 commits into from
Oct 17, 2024

Conversation

sviderock
Copy link
Contributor

@sviderock sviderock commented Oct 14, 2024

Description

7th PR for RET-1207. Add "No more transactions" toast when:

  • the first page is the only page and there's decent amount of transactions to trigger the scroll
  • next page returns an empty array

This behaviour will be changed in the follow-up PR once connected to the new blockchain-api handler.

Test plan

Adds tests to check the new toast behaviour.

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 Oct 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.77%. Comparing base (8533127) to head (5146004).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##             main    #6153    +/-   ##
========================================
  Coverage   88.76%   88.77%            
========================================
  Files         728      728            
  Lines       30827    30835     +8     
  Branches     5639     5640     +1     
========================================
+ Hits        27364    27373     +9     
- Misses       3266     3420   +154     
+ Partials      197       42   -155     
Files with missing lines Coverage Δ
src/transactions/feed/TransactionFeedV2.tsx 90.74% <100.00%> (+0.48%) ⬆️

... and 67 files 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 8533127...5146004. Read the comment docs.


const isFirstPage = originalArgs?.endCursor === FIRST_PAGE_TIMESTAMP
const moreThanMinumumTransactions = (data?.transactions || []).length > MIN_NUM_TRANSACTIONS
const isFirstPageWithEnoughtTransactions = isFirstPage && moreThanMinumumTransactions
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const isFirstPageWithEnoughtTransactions = isFirstPage && moreThanMinumumTransactions
const isFirstPageWithEnoughTransactions = isFirstPage && moreThanMinumumTransactions

const isFirstPage = originalArgs?.endCursor === FIRST_PAGE_TIMESTAMP
const moreThanMinumumTransactions = (data?.transactions || []).length > MIN_NUM_TRANSACTIONS
const isFirstPageWithEnoughtTransactions = isFirstPage && moreThanMinumumTransactions
const shouldShowToast = isFirstPageWithEnoughtTransactions || !isFirstPage
Copy link
Contributor

Choose a reason for hiding this comment

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

Hrm this logic feels a bit weird in the edge cases - imagine we have only 2 pages, both with 1 TX each. In that case, we won't hit the "minimum transactions", but we'll always show the toast since we're not on the first page. On the other hand, if we only have 1 page with 2 TXs, we will not show the toast, since we're on the first page with not enough transactions. It seems like the only thing we really need to check is whether or not there are enough transactions to reach the minimum, and we can safely ignore what page we're on? (Once the feed is populated with data, the concept of pagination is hidden from the user anyways, so why do we need to conditionally display the toast depending on which page # we're on?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jophish You're right, I totally overthought this one!

Copy link
Contributor

@jophish jophish left a comment

Choose a reason for hiding this comment

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

🎉

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.

🚀

Base automatically changed from slava/feed-v2-handle-empty-feed to main October 17, 2024 07:15
@sviderock sviderock added this pull request to the merge queue Oct 17, 2024
Merged via the queue into main with commit 542aa4a Oct 17, 2024
15 checks passed
@sviderock sviderock deleted the slava/feed-v2-no-more-transactions-toast branch October 17, 2024 09:13
bakoushin pushed a commit that referenced this pull request Oct 17, 2024
### Description
7th PR for RET-1207. Add "No more transactions" toast when:
- the first page is the only page and there's decent amount of
transactions to trigger the scroll
- next page returns an empty array

This behaviour will be changed in the follow-up PR once connected to the
new blockchain-api handler.

### Test plan
Adds tests to check the new toast behaviour.

### Related issues
- Relates to RET-1207

### Backwards compatibility
Yes

### Network scalability

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

- [x] Continue to work without code changes, OR trigger a compilation
error (guaranteeing we find it when a new network is added)
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.

3 participants