-
Notifications
You must be signed in to change notification settings - Fork 268
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
Jon/fix/coinrank-loading #5544
Conversation
7c1c8d7
to
844c97f
Compare
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 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) { |
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.
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?
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.
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.
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'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}`) |
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 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.
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.
Ah good catch yeah I didn't update this to be publicly readable from my own testing
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 looks like a good approach to solving the problem. Well done! Approved, with consideration that this is well tested to be a solution.
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.
844c97f
to
423ae98
Compare
CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
noneRequirements
If you have made any visual changes to the GUI. Make sure you have: