Skip to content

Commit

Permalink
fix: only show warning ack when previewing (#8465)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xApotheosis authored Jan 6, 2025
1 parent 27eb825 commit 636a011
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,16 @@ export const TradeFooterButton: FC<TradeFooterButtonProps> = ({
}, [tradeButtonProps, setHasClickedButton])

const handleClick = useCallback(() => {
if (isModeratePriceImpact) {
const isInitializingOrPreviewing =
confirmedTradeExecutionState === TradeExecutionState.Initializing ||
confirmedTradeExecutionState === TradeExecutionState.Previewing
// Only show the warning acknowledgement if the user is previewing the trade
if (isModeratePriceImpact && isInitializingOrPreviewing) {
setShouldShowWarningAcknowledgement(true)
} else {
handleSubmit()
}
}, [isModeratePriceImpact, handleSubmit])
}, [isModeratePriceImpact, handleSubmit, confirmedTradeExecutionState])

// Ratio of the fiat value of the gas fee to the fiat value of the trade value express in percentage
const isFeeRatioOverThreshold = useMemo(() => {
Expand Down

0 comments on commit 636a011

Please sign in to comment.