Skip to content

Commit

Permalink
remove swap remount on external change
Browse files Browse the repository at this point in the history
  • Loading branch information
nohaapav committed Jun 11, 2024
1 parent d245a50 commit c0eba76
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@galacticcouncil/math-staking": "^1.0.0",
"@galacticcouncil/math-xyk": "^1.0.0",
"@galacticcouncil/sdk": "^3.0.1",
"@galacticcouncil/ui": "^4.0.2",
"@galacticcouncil/ui": "^4.0.3",
"@galacticcouncil/xcm-cfg": "^2.5.0",
"@galacticcouncil/xcm-core": "^1.4.0",
"@galacticcouncil/xcm-sdk": "^3.3.0",
Expand Down
9 changes: 0 additions & 9 deletions src/sections/trade/sections/swap/SwapPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ import { useAccount } from "sections/web3-connect/Web3Connect.utils"
import { useDisplayAssetStore } from "utils/displayAsset"
import { isEvmAccount } from "utils/evm"
import { NATIVE_ASSET_ID } from "utils/api"
import { useRemount } from "hooks/useRemount"
import { ExternalAssetImportModal } from "sections/trade/modal/ExternalAssetImportModal"
import { AddTokenModal } from "sections/wallet/addToken/modal/AddTokenModal"
import { useState } from "react"
import { useUserExternalTokenStore } from "sections/wallet/addToken/AddToken.utils"

const defaultEvmTokenId: string = import.meta.env.VITE_EVM_NATIVE_ASSET_ID

Expand Down Expand Up @@ -61,14 +59,8 @@ export function SwapPage() {
const { stableCoinId } = useDisplayAssetStore()
const preference = useProviderRpcUrlStore()
const [addToken, setAddToken] = useState(false)
const { tokens: externalTokensStored } = useUserExternalTokenStore.getState()

const isEvm = isEvmAccount(account?.address)
const version = useRemount([
isEvm,
externalTokensStored[preference.getDataEnv()].length,
])

const rpcUrl = preference.rpcUrl ?? import.meta.env.VITE_PROVIDER_URL

const rawSearch = useSearch<SearchGenerics>()
Expand Down Expand Up @@ -125,7 +117,6 @@ export function SwapPage() {
return (
<SContainer>
<SwapApp
key={version}
ref={(r) => {
if (r) {
r.setAttribute("chart", "")
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2646,10 +2646,10 @@
bignumber.js "^9.1.0"
lodash.clonedeep "^4.5.0"

"@galacticcouncil/ui@^4.0.2":
version "4.0.2"
resolved "https://registry.yarnpkg.com/@galacticcouncil/ui/-/ui-4.0.2.tgz#85ad9ca689bed0b6196ad8d94f84739befe0c5f8"
integrity sha512-1VxyDZTbuXu8BIKco3yxzmdjbZIy6hn1pqhkUq4nPa6PqBIab3hNScHwah4hL+F4znT1eGRHbRqb9H5W9SaFbA==
"@galacticcouncil/ui@^4.0.3":
version "4.0.3"
resolved "https://registry.yarnpkg.com/@galacticcouncil/ui/-/ui-4.0.3.tgz#23f633e104e805f33f43e676f2e41b061c8c6f8c"
integrity sha512-BvNOkfS03p3l3kij+tOK2HAgTVDcyT3uCyY/YnYMA73mJFJIX3biG9iAaxKwhCskKA0yXlaX7c+yoPKX97KE+g==
dependencies:
"@floating-ui/dom" "^1.5.1"
"@lit/reactive-element" "^1.0.0"
Expand Down

0 comments on commit c0eba76

Please sign in to comment.