-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[7] fix(tokens): fix tokens list loading state #3201
[7] fix(tokens): fix tokens list loading state #3201
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
418081f
to
840af3f
Compare
…wprotocol/cowswap into refactor/tokens-post-review-fixes
…wprotocol/cowswap into refactor/tokens-post-review-fixes
Thanks for the diagrams in the library! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to finally test everything!
Some comments on the code.
As for testing:
There's no indication of list loading, when searching for a new one:
Screen.Recording.2023-10-19.at.11.25.07.mov
When removing a token that's currently selected, I immediately get a prompt to add the token back
Screen.Recording.2023-10-19.at.11.27.56.mov
GNO has a square logo? I think we used to round them in the UI.
ETH disappears from the list sometimes, apparently while it's loading.
Screen.Recording.2023-10-19.at.11.30.58.mov
There's a test item to reset favourite to defaults. How do I do that?
import { useCallback } from 'react' | ||
import { useIsUnsupportedToken } from './useIsUnsupportedToken' | ||
|
||
type NullishAddress = string | null | undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you don't want to use Nullish
because that's in the main app and it would create a circular dependency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You know my mind :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to move common types to some a new lib in the future
@@ -1,20 +1,16 @@ | |||
import { useUnsupportedTokens } from './useUnsupportedTokens' | |||
import { useCallback } from 'react' | |||
|
|||
export function useIsUnsupportedToken() { | |||
type NullishAddress = string | null | undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Repeated type. What about move it to the token app types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you mind if I do it in the next iteration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, no problem
*/ | ||
export function tokenMapToListWithLogo(tokenMap: TokensMap): TokenWithLogo[] { | ||
return Object.values(tokenMap) | ||
.sort((a, b) => (a.symbol > b.symbol ? 1 : -1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it mater it they are lower cased for the comparison?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any difference, maybe because the majority of tokens have uppercased symbols
@alfetopito added the loader: 6a7a227 |
This is not a new issue (exiting on prod), I would like to fix it in the next iteration if you don't mind |
@alfetopito thanks! Fixed |
@alfetopito sorry, I didn't add the scenario:
|
@alfetopito hmmm, I can't reproduce it now. Could you give steps on how to get it? |
I don't know exactly what are the steps. Screen.Recording.2023-10-23.at.11.40.31.movMaybe try to slow down your connection a bit? Watching the network calls, the ETH price seems to be displayed only when the blocknative call completes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested again, only the ETH disappearing from the list issue remains
@alfetopito thank you! Fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's working \o/
if (getIsNativeToken(a) || getIsNativeToken(b)) return 1 | ||
if (aIsNative || bIsNative) { | ||
return aIsNative ? -1 : 1 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha, I knew it!
9c4bfdf
into
refactor/tokens-remove-legacy
Summary
This is a final PR where I add all fixes after code-review / QA.
I also added test plan for the whole refactoring below:
To Test
TokensListsUpdater
updates it every 6 hours)libs/analytics/src/events/listEvents.ts
TODO