Skip to content

Commit

Permalink
swap page crash fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vnaysngh-mudrex committed Feb 7, 2024
1 parent 38d7132 commit 819f87d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/hooks/starknet-react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ export const useAccountDetails = (): {

useEffect(() => {
const fetchChainId = async () => {
try {
const Id = await provider.getChainId()
const convertedId: ChainId | undefined = convertStarknetToChainId(Id)
setChainId(convertedId)
} catch (error) {
console.error('Error fetching chainId:', error)
if (account) {
try {
const Id = await provider.getChainId()
const convertedId: ChainId | undefined = convertStarknetToChainId(Id)
setChainId(convertedId)
} catch (error) {
console.error('Error fetching chainId:', error)
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useV3SwapPools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export function useV3SwapPools(
pools: Pool[]
loading: boolean
} {
if (!allPools?.length) return { pools: [], loading: false }
if (!allPools || !allPools?.length) return { pools: [], loading: false }

const poolProps = allPools.map((poolAddress: string) => getPoolProps(poolAddress))

Expand Down

0 comments on commit 819f87d

Please sign in to comment.