Skip to content

Jon/fix/coinrank-loading #5544

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

Merged
merged 5 commits into from
May 2, 2025
Merged

Jon/fix/coinrank-loading #5544

merged 5 commits into from
May 2, 2025

Conversation

Jon-edge
Copy link
Collaborator

@Jon-edge Jon-edge commented Apr 23, 2025

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Requirements

If you have made any visual changes to the GUI. Make sure you have:

  • Tested on iOS device
  • Tested on Android device
  • Tested on small-screen device (iPod Touch)
  • Tested on large-screen device (tablet)

@Jon-edge Jon-edge force-pushed the jon/fix/coinrank-loading branch 3 times, most recently from 7c1c8d7 to 844c97f Compare May 1, 2025 22:46
Copy link
Contributor

@samholmes samholmes left a comment

Choose a reason for hiding this comment

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

This looks like a good approach to solving the problem. Well done! Approved, with consideration that this is well tested to be a solution.

@@ -157,7 +157,7 @@ const CoinRankingComponent = (props: Props) => {

try {
// Catch up to the total required items
while (startIndex < requestDataSize - QUERY_PAGE_SIZE) {
while (startIndex <= requestDataSize - QUERY_PAGE_SIZE + 1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this fix an issue where the last item wasn't included for some reason? It's hard to know what the problem was and therefore review a fix if you don't know what the problem is. Could you maybe include the problem in the commit body?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, and this also fixes the issue where the query doesn't start immediately under some situations.

You can see in the changes you reviewed previously, I had a condition startIndex === 1 || ... which resolved the "not starting immediately" issue, but didn't fix the new page requests sometimes not fetching new rows.

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'll edit the commit message

@@ -176,7 +176,7 @@ const CoinRankingComponent = (props: Props) => {
startIndex += QUERY_PAGE_SIZE
}
} catch (e: any) {
console.warn(`Error during data fetch: ${e.message}`)
console.warn(`Error during data fetch: ${e.message}, ${coingeckoFiat}, ${startIndex}, ${requestDataSize}`)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is good, but Error during data fetch: ${e.message} (${coingeckoFiat} from ${startIndex} to ${requestDataSize}) might be a clearer output to read cause it formats the numbers with prefixes like from and to also puts this in a separate parenthetical structure.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah good catch yeah I didn't update this to be publicly readable from my own testing

Copy link
Contributor

@samholmes samholmes left a comment

Choose a reason for hiding this comment

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

This looks like a good approach to solving the problem. Well done! Approved, with consideration that this is well tested to be a solution.

Jon-edge added 5 commits May 2, 2025 14:22
It was possible under some situations for the first query to fail this
condition and either not load the first or last page.
Previously, we were always clearing the cache intentionally on a fiat change, but unintentionally also on unmounting the scene, so the cache wasn't utilized when re-mounting the scene.

This change requires keeping track of the scene's last known fiat in case it changes while the scene is unmounted, which should result in a clearing of the cache upon re-mount.
@Jon-edge Jon-edge force-pushed the jon/fix/coinrank-loading branch from 844c97f to 423ae98 Compare May 2, 2025 21:23
@Jon-edge Jon-edge enabled auto-merge May 2, 2025 21:24
@Jon-edge Jon-edge merged commit 305a279 into develop May 2, 2025
2 checks passed
@Jon-edge Jon-edge deleted the jon/fix/coinrank-loading branch May 2, 2025 21:40
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.

2 participants