Skip to content
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

chore: compute price change if sortedOracleDailyPrices > 2 #79

Merged
merged 2 commits into from
Jun 7, 2024

Conversation

rabi-siddique
Copy link
Contributor

@rabi-siddique rabi-siddique commented Jun 7, 2024

While testing locally, I encountered an error where typeOutAmountLast was null, causing the UI to break. To determine the 24h price change, sortedOracleDailyPrices needs to contain at least two objects (today's and yesterday's prices), but this was not the case.

This PR addresses this edge case by ensuring we only compute the price change if sortedOracleDailyPrices contains at least two objects.

Otherwise, we reflect this in the UI:
image

Copy link

cloudflare-workers-and-pages bot commented Jun 7, 2024

Deploying agoric-inter-dashboard with  Cloudflare Pages  Cloudflare Pages

Latest commit: d6cb18b
Status: ✅  Deploy successful!
Preview URL: https://ae7ee4fa.agoric-inter-dashboard.pages.dev
Branch Preview URL: https://rs-error-handle-token-prices.agoric-inter-dashboard.pages.dev

View logs

Copy link

github-actions bot commented Jun 7, 2024

Cloudflare deployment logs are available here

@rabi-siddique rabi-siddique force-pushed the rs-error-handle-token-prices branch from 9c825c1 to db89184 Compare June 7, 2024 10:03
@rabi-siddique rabi-siddique requested a review from frazarshad June 7, 2024 10:05
@@ -38,7 +38,7 @@ export function TokenPrices({ title = 'Summary', data, isLoading }: Props) {
// Determine 24h change in oracle price
const sortedOracleDailyPrices = token?.oracleDailyPrices?.sort((a, b) => b.dateKey - a.dateKey);
const changeValue =
sortedOracleDailyPrices.length > 0
sortedOracleDailyPrices.length > 2
Copy link
Contributor

Choose a reason for hiding this comment

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

length of two would be a valid case

Suggested change
sortedOracleDailyPrices.length > 2
sortedOracleDailyPrices.length >= 2

@rabi-siddique rabi-siddique force-pushed the rs-error-handle-token-prices branch from db89184 to d6cb18b Compare June 7, 2024 13:06
@rabi-siddique rabi-siddique merged commit 20c51cb into master Jun 7, 2024
2 checks passed
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