-
Notifications
You must be signed in to change notification settings - Fork 5.5k
feat: increase swap friction when price data is not available #41972
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
Changes from all commits
c553aa5
5a06cad
92a8cca
420e82a
829b889
eb7fd44
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ import { shallowEqual, useSelector } from 'react-redux'; | |
| import { useMemo } from 'react'; | ||
| import { | ||
| type BridgeAppState, | ||
| getActiveQuotePriceData, | ||
| getBridgeUnavailableQuoteReason, | ||
| getFormattedPriceImpactFiat, | ||
| getFormattedPriceImpactPercentage, | ||
|
|
@@ -52,6 +53,8 @@ export const useBridgeAlerts = () => { | |
| const { tokenAlerts, txAlert } = useSecurityAlerts(); | ||
| const { openBuyCryptoInPdapp } = useRamps(); | ||
|
|
||
| const activeQuotePriceData = useSelector(getActiveQuotePriceData); | ||
|
|
||
| const { isLoading, activeQuote: unvalidatedQuote } = | ||
| useSelector(getBridgeQuotes); | ||
| const activeQuote = isQuoteExpiredOrInvalid({ | ||
|
|
@@ -133,6 +136,19 @@ export const useBridgeAlerts = () => { | |
| }); | ||
| } | ||
|
|
||
| if (unvalidatedQuote && !activeQuotePriceData) { | ||
| categorizeAlert({ | ||
| id: 'price-data-unavailable', | ||
| severity: 'danger', | ||
| title: t('bridgeNoPriceInfoTitle'), | ||
| description: t('bridgePriceDataUnavailableError'), | ||
| isConfirmationAlert: true, | ||
| bannerAlertProps: { | ||
| severity: BannerAlertSeverity.Danger, | ||
| }, | ||
| }); | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Stale quote triggers false "no price" alert alongside "no quotes"Medium Severity The Reviewed by Cursor Bugbot for commit 09cb6ba. Configure here. |
||
|
|
||
| if ( | ||
| !isLoading && | ||
| activeQuote && | ||
|
|
@@ -194,6 +210,8 @@ export const useBridgeAlerts = () => { | |
| }; | ||
| }, [ | ||
| activeQuote, | ||
| unvalidatedQuote, | ||
| activeQuotePriceData, | ||
| bridgeUnavailableQuotesReason, | ||
| formattedPriceImpactPercentage, | ||
| formattedPriceImpactFiat, | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.