From 108c6ea78923233c7d9e8ecf19a275f979ce4123 Mon Sep 17 00:00:00 2001 From: dave Date: Tue, 29 Mar 2022 13:41:07 +0100 Subject: [PATCH] add userAddress to quoteParamChanged check (#2605) --- src/custom/state/price/updater.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/custom/state/price/updater.ts b/src/custom/state/price/updater.ts index a46c1cbcc..3ef0b5802 100644 --- a/src/custom/state/price/updater.ts +++ b/src/custom/state/price/updater.ts @@ -59,12 +59,15 @@ function quoteUsingSameParameters(currentParams: FeeQuoteParams, quoteInfo: Quot sellToken: currentSellToken, buyToken: currentBuyToken, kind: currentKind, + userAddress: currentUserAddress, } = currentParams - const { amount, buyToken, sellToken, kind } = quoteInfo - - return ( + const { amount, buyToken, sellToken, kind, userAddress } = quoteInfo + // cache the base quote params without quoteInfo user address to check + const paramsWithoutAddress = sellToken === currentSellToken && buyToken === currentBuyToken && amount === currentAmount && kind === currentKind - ) + // 2 checks: if there's a quoteInfo user address (meaning quote was already calculated once) and one without + // in case user is not connected + return userAddress ? currentUserAddress === userAddress && paramsWithoutAddress : paramsWithoutAddress } /**