fix: handled circleLogoUrl undefined.
Fixes: #4897 Fixes: #4900 Fixes: #4908 Fixes: #4912
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Updated |
|---|---|---|---|
| interface | ✅ Ready (Inspect) | Visit Preview | Oct 14, 2022 at 2:21AM (UTC) |
Could you add:
- src/components/Tokens/TokenTable/TokenRow.tsx line 486
Also, the root cause of this is that
CHAIN_NAME_TO_CHAIN_ID[token.chain]may be returning undefined. Can you replace any instances ofCHAIN_NAME_TO_CHAIN_ID[chain]with a new method,getChainNameForChainId(chainId: number): SupportedChainId | undefined? That will fix the typing, so that typescript does not even let us access circleLogoUrl without the optional operator.
I think it'd be enough to add TokenRow.tsx to get this merged. Fixing the root cause can be done in a follow-up (by you or by us).
@zzmp
Apologized for this PR change, previously I thought this is just an optional chaining issue, so I set it up on Gitpod, but there is a CORS error for me to fetch the data:

I found that all the PRs deployed here have no such issues, so I attempted to push it here, unfortunately, the PR not solved the undefined issue.
I will try to clone it on my M1 mac and see if localhost has CORS error 👀
Can you replace any instances of
CHAIN_NAME_TO_CHAIN_ID[chain]with a new method,getChainNameForChainId(chainId: number): SupportedChainId | undefined?
Would this be getChainIdForChainName(chainName: string)? 👀
Hi @zzmp
I just marked the PR as ready for review, getChainIdForChainName(chainName: string) will not solve the problem because the getChainInfo function signature would be changed to this line if chainId is undefined:
https://github.com/Uniswap/interface/blob/332843f428b308e071b7ba8324aa50e4b8046aa2/src/constants/chainInfo.ts#L224-L226
so that we still need optional chaining for undefined.