-
Notifications
You must be signed in to change notification settings - Fork 4
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
Fix ENS and UNS names not visible in UI #879
Conversation
✅ Deploy Preview for taho-development ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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 feel like we were missing some connections between utils <> cache <> redux but to me it seems like they are still not quite there yet. What about utilizing some redux features (async thunks? maybe names need to have their own service?) to trigger the state changes correctly without a need to use events on window object?
src/shared/hooks/wallets.ts
Outdated
if (ens) setAccountName(ens.name) | ||
if (uns) setAccountName(uns.name) |
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.
ENS names should override UNS names if user has both (same as we have it in the wallet)
window.addEventListener("storage", handleCachedNamesUpdate) | ||
|
||
return () => window.removeEventListener("storage", handleCachedNamesUpdate) |
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.
Feels like we are doing something weird trying to communicate between a util and a hook via events on the window. I feel like we are trying to achieve the same thing here as we would have if we just triggered the change on the redux slice?
src/ui/Nav/AccountInfo.tsx
Outdated
@@ -10,7 +10,11 @@ import { getRealmColor } from "shared/constants" | |||
import Avatar from "shared/components/Media/Avatar" | |||
import AccountDropdown from "./AccountDropdown" | |||
|
|||
export default function AccountInfo() { | |||
type AccountInfoProps = { | |||
accountName: string | null |
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.
why can't we just rely on the const name = useDappSelector(selectWalletName)
? having two sources of truth here smells like a bad idea.
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 love this approach but let's just make it work 🚀
Issues connected
Resolves #823
What has been done
useCachedWalletName
hookTesting
localStorage