Closed Abi-Liu closed 10 months ago
Potential fix:
This change will help solve both this issue as well as issue https://github.com/Abi-Liu/Spendify/issues/24. We can add a 'total_transactions` row for each user, item, and account. On new webhook receival, we can update these counts to correctly match the new data. This will make it a lot easier to deal with whether or not we have a valid next page and also the number of pages we have.
Refactor the getTransactionsPagination controller to not only return the sanitized transaction data, but also to return a nextPage
value that can be true
if there are additional transactions, and false
if not. We can use the values stored in the users, items, and accounts row to correctly determine if there are new pages or not.
if users are going through their transactions and they reach the last page, there is a case where the user can press the next page button without there actually being more transactions.
With the current implementation, if we are on the last page sorting by X amount and the last page also has X amount of transactions showing, the next page button will not be disabled even though there are no more transactions for the user.
`<Button variant="transparent" color="gray" onClick={nextPage} disabled={transactions.length < limit}
note that if transactions.length !< limit, we will be able to go to the next page.