Skip to content

Commit

Permalink
fix(homefeed): avoid showing 'no more transactions' toast when too fe…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
kathaypacific authored Aug 12, 2022
1 parent 88fd4a5 commit 9787ecc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/transactions/feed/queryHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ export function useFetchTransactions(): QueryHookResult {
fetchMoreTransactions: () => {
if (!fetchedResult.pageInfo) {
dispatch(showError(ErrorMessages.FETCH_FAILED))
} else if (!fetchedResult.pageInfo?.hasNextPage) {
} else if (
!fetchedResult.pageInfo?.hasNextPage &&
fetchedResult.transactions.length > MIN_NUM_TRANSACTIONS
) {
Toast.showWithGravity(t('noMoreTransactions'), Toast.SHORT, Toast.CENTER)
} else {
setFetchingMoreTransactions(true)
Expand Down

0 comments on commit 9787ecc

Please sign in to comment.