-
Notifications
You must be signed in to change notification settings - Fork 86
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(homefeed): ensure that users can scroll to load more #2779
Conversation
src/transactions/feed/queryHelper.ts
Outdated
if (!paginatedResult) { | ||
setFetchedResult((prev) => ({ | ||
transactions: deduplicateTransactions(prev.transactions, returnedTransactions), | ||
pageInfo: returnedPageInfo ?? null, |
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.
@dievazqu this is one part of the logic that i changed (compared to line 94 from the previous version), can you think of any places where this condition is not okay? for the few cases i tested, this works okay
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 seems ok!
Codecov Report
@@ Coverage Diff @@
## main #2779 +/- ##
==========================================
+ Coverage 79.74% 79.75% +0.01%
==========================================
Files 600 600
Lines 21729 21739 +10
Branches 3948 3958 +10
==========================================
+ Hits 17327 17338 +11
+ Misses 4355 4353 -2
- Partials 47 48 +1
Continue to review full report at Codecov.
|
src/transactions/feed/queryHelper.ts
Outdated
|
||
const returnedTransactions = result.data?.tokenTransactionsV2?.transactions | ||
const returnedPageInfo = result.data?.tokenTransactionsV2?.pageInfo | ||
|
||
if (returnedTransactions?.length) { |
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.
I think we have to change this...
Because if the returned transactions are empty, but it's not the last page (meaning that hasNextPage
is true, but the blockchain-api has filtered out all the unknown transactions), we still have to update fetchedResult.pageInfo
so when we query again we get a different page.
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.
oh excellent point, i can add a check for pageInfo here
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.
fixed and added a test
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.
LGTM!
I tested it with my android emulator (Pixel 2 API 29 / 1080 x 1920: 420dpi / Android 10.0 / x86). |
dispatch(showError(ErrorMessages.FETCH_FAILED)) | ||
} else if (!pageInfo.hasNextPage) { | ||
// If the user has a few transactions, don't show any message | ||
if (transactions.length > 20) { |
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.
i thought this was an odd requirement so i removed it :/
### Description Context: https://valora-app.slack.com/archives/C018VLA3YAK/p1660091022594799 The solution chosen for this issue is to continue to fetch transactions from the client until a minimum threshold is met (currently 10) so that the section list is filled and the user can scroll to load more. In this PR: - To ensure no weird bugs and avoid concurrency issues, i refactored the state variables to keep the cumulative transactions + pageInfo in the same state variable so that they are always in sync. - Added a hook to refetch transactions until we have 10, and refetch transactions if the returned page is empty - Updated tests ### Other changes N/A ### Tested Manually and with unit tests ### How others should test Please try this with many accounts that have varying number of transactions - load the app (from a fresh install, and from cold start) and ensure that the home feed displays transactions. If the account has many transactions, ensure that you can scroll down to load more transactions. ### Related issues N/A ### Backwards compatibility Yes
…w transactions (#2783) ### Description Annoyingly, the `onEndReached` callback is triggered on the SectionList used to render the transaction feed when navigating away from the screen on iOS, when the transaction list is too short. This causes the "no more transactions" toast to appear on the next page that is navigated to, but only once. This check for length of transactions used to exist, and I had removed it thinking it was strange #2779 (comment) - but it seems like we need it. ### Other changes N/A ### Tested Manually ### How others should test N/A ### Related issues N/A ### Backwards compatibility Yes
…w transactions (#2783) ### Description Annoyingly, the `onEndReached` callback is triggered on the SectionList used to render the transaction feed when navigating away from the screen on iOS, when the transaction list is too short. This causes the "no more transactions" toast to appear on the next page that is navigated to, but only once. This check for length of transactions used to exist, and I had removed it thinking it was strange #2779 (comment) - but it seems like we need it. ### Other changes N/A ### Tested Manually ### How others should test N/A ### Related issues N/A ### Backwards compatibility Yes
Hey @MuckT, We have verified the above task using Latest Android Internal Release Build, iOS Test Flight Release Build V1.38.2 & observed the following:
Devices: Google Pixel XL (10.0), iPhone 13 mini(15.1.1), Google Pixel 4a(12.0) CC: @kathaypacific |
Hey @MuckT we have verified the above task on Latest iOS Test Flight Release build & Android Internal Release Build V 1.39.1 & updated status in Test rails Observation:
Test rail link: Device : iPhone 12(14.7.1), Google Pixel 4a(12.0), Samsung Galaxy F41(11.0) |
Hey @MuckT we have verified the above task on Latest iOS Test Flight Release build V 1.39.1 & updated status in Test rails Observation:
Test rail link: Device : iPhone 13 mini(15.1.1) CC: @kathaypacific Thanks.!! |
Description
Context: https://valora-app.slack.com/archives/C018VLA3YAK/p1660091022594799
The solution chosen for this issue is to continue to fetch transactions from the client until a minimum threshold is met (currently 10) so that the section list is filled and the user can scroll to load more.
In this PR:
Other changes
N/A
Tested
Manually and with unit tests
How others should test
Please try this with many accounts that have varying number of transactions - load the app (from a fresh install, and from cold start) and ensure that the home feed displays transactions. If the account has many transactions, ensure that you can scroll down to load more transactions.
Related issues
N/A
Backwards compatibility
Yes