Skip to content

Commit

Permalink
Show quote errors even if disconnected (#568)
Browse files Browse the repository at this point in the history
* Show quote errors even if disconnected

* Set always the error
  • Loading branch information
anxolin authored Jun 8, 2022
1 parent fa854fd commit 5a0e4b8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/custom/pages/Swap/SwapMod.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -761,10 +761,6 @@ export default function Swap({
<Trans>Unsupported Token</Trans>
</ThemedText.Main>
</ButtonPrimary>
) : !account ? (
<ButtonPrimary buttonSize={ButtonSize.BIG} onClick={toggleWalletModal}>
<SwapButton showLoading={swapBlankState || isGettingNewQuote}>Connect Wallet</SwapButton>
</ButtonPrimary>
) : !isSupportedWallet ? (
<ButtonError buttonSize={ButtonSize.BIG} id="swap-button" disabled={!isSupportedWallet}>
<Text fontSize={20} fontWeight={500}>
Expand Down Expand Up @@ -822,6 +818,10 @@ export default function Swap({
<GreyCard style={{ textAlign: 'center' }}>
<ThemedText.Main mb="4px">Error loading price. You are currently offline.</ThemedText.Main>
</GreyCard>
) : !account ? (
<ButtonPrimary buttonSize={ButtonSize.BIG} onClick={toggleWalletModal}>
<SwapButton showLoading={swapBlankState || isGettingNewQuote}>Connect Wallet</SwapButton>
</ButtonPrimary>
) : showApproveFlow ? (
<AutoRow style={{ flexWrap: 'nowrap', width: '100%' }}>
<AutoColumn style={{ width: '100%' }} gap="12px">
Expand Down
13 changes: 6 additions & 7 deletions src/custom/state/price/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,12 @@ export default createReducer(initialState, (builder) =>
initializeState(quotes, action)

// Sets the error information
const quoteInformation = quotes[chainId][sellToken]
if (quoteInformation) {
quotes[chainId][sellToken] = {
...quoteInformation,
...payload,
price: getResetPrice(sellToken, buyToken, kind),
}
const quoteInformation = quotes[chainId][sellToken] || {}
quotes[chainId][sellToken] = {
...quoteInformation,
...payload,
price: getResetPrice(sellToken, buyToken, kind),
lastCheck: Date.now(),
}

// Stop the loaders
Expand Down

0 comments on commit 5a0e4b8

Please sign in to comment.