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

fix(usd-amount): delete token from queue only if there are no subscribers left #3121

Merged
merged 3 commits into from
Sep 8, 2023

Conversation

shoom3301
Copy link
Collaborator

@shoom3301 shoom3301 commented Sep 7, 2023

Summary

Fixes #3105 (comment)

useUsdPrice() can be used several times on one page.
Before the fix, I removed a token from USD price queue even when one of the consumers unsubscribed.
After the fix I remove a token from queue only when there are no subscribers left.

To Test

  1. Place swap (input is cleared)
  2. Pick pair and insert data
  3. Trade is filled
  4. Price impact is not loaded until I change the inputs/refresh the page

@shoom3301 shoom3301 added the RELEASE Included in the release that is being closed label Sep 7, 2023
@shoom3301 shoom3301 requested a review from a team September 7, 2023 16:26
@shoom3301 shoom3301 self-assigned this Sep 7, 2023
@vercel
Copy link

vercel bot commented Sep 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
swap-dev ✅ Ready (Inspect) Visit Preview Sep 7, 2023 5:26pm

🌃 Cosmos ↗︎

@shoom3301 shoom3301 force-pushed the fix/usd-amount-queue-reset branch from 75367c7 to 3f5e116 Compare September 7, 2023 16:38
@alfetopito
Copy link
Collaborator

Still happened to me

image

The surplus modal was displayed.
Then when I closed it, WETH price was gone.

Can it be that, since we use usd prices on the surplus modal, when the modal is closed, the price is removed?

@shoom3301 shoom3301 changed the title fix(usd-amount): debounce deletion currency from USD price queue fix(usd-amount): delete token from queue only if there are no subscribers left Sep 7, 2023
@shoom3301 shoom3301 force-pushed the fix/usd-amount-queue-reset branch 2 times, most recently from 358b753 to 129e691 Compare September 7, 2023 17:16
@shoom3301
Copy link
Collaborator Author

@alfetopito awesome point!
Refactored logic, tested, works well now

@shoom3301 shoom3301 force-pushed the fix/usd-amount-queue-reset branch from 129e691 to 91f2e87 Compare September 7, 2023 17:18
Copy link
Collaborator

@alfetopito alfetopito left a comment

Choose a reason for hiding this comment

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

Awesome fix!

@shoom3301 shoom3301 mentioned this pull request Sep 8, 2023
@shoom3301 shoom3301 merged commit bb95c94 into release/1.47.0 Sep 8, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Sep 8, 2023
@alfetopito alfetopito deleted the fix/usd-amount-queue-reset branch September 8, 2023 13:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
RELEASE Included in the release that is being closed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants