feat(BA-2555): Set primary flow for EOAs in Web#2615
Conversation
…to amiecorso/ba-2555-set-primary-flow-for-eoas-in-web
✅ Heimdall Review Status
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| <span className="rounded-full bg-white px-2 py-1 text-sm text-black">Primary</span> | ||
| <span className="flex items-center gap-2 rounded-full bg-white px-2 py-1 text-sm text-black"> | ||
| {isPending || isUpdatingPrimary ? ( | ||
| <Spinner className="h-3 w-3 animate-spin" aria-hidden={true} /> |
There was a problem hiding this comment.
Instead of using this we should use: <Icon name="spinner" color="currentColor" /> from 'apps/web/src/components/Icon/Icon';.
It's what we use elsewhere in the codebase and it doesn't need the type casting done above
|
|
||
| const PrimaryUpdateContext = createContext<PrimaryUpdateContextValue | undefined>(undefined); | ||
|
|
||
| export function PrimaryUpdateProvider({ children }: { children: React.ReactNode }) { |
There was a problem hiding this comment.
This provider feels unnecessary since it's only used in two files that are related to each other. Instead, you can add a useState to useRemoveNameFromUI:
const [isUpdatingPrimary, setIsUpdatingPrimary] = useState(false);
And then return isUpdatingPrimary from there so that NameDisplay can use it. Then you won't need this provider/context
| return { setPrimaryUsername }; | ||
| // Drive the spinner strictly off the on-chain write phase | ||
| useEffect(() => { | ||
| setIsUpdatingPrimary(isWriting); |
There was a problem hiding this comment.
If the isUpdatingPrimary is derived directly from isWriting, do we even need the state? Could NameDisplay just use isWriting to render the spinner?
There was a problem hiding this comment.
yep, managed to get this working using existing pending status
| canSetUsernameAsPrimary, | ||
| isLoading, | ||
| transactionIsSuccess: transactionIsSuccess || batchCallsIsSuccess, | ||
| isWriting: transactionIsLoading || batchCallsIsLoading, |
There was a problem hiding this comment.
I think we need a better name than isWriting. It could be confused with the existing isLoading which also checks these two states
There was a problem hiding this comment.
agreed, will go with transactionPending ?
| canSetUsernameAsPrimary, | ||
| isLoading, | ||
| transactionIsSuccess: transactionIsSuccess || batchCallsIsSuccess, | ||
| transactionPending: transactionIsLoading || batchCallsIsLoading, |
There was a problem hiding this comment.
Is this used anywhere?
There was a problem hiding this comment.
yeah, it's used to set isPending which is returned from useUpdatePrimaryName and then used in the name display to manage the badge
What changed? Why?
Adds the "Set primary" name flow for EOAs against new contracts (signature-based).
Notes to reviewers
How has it been tested?
Screen.Recording.2025-09-11.at.3.08.32.PM.mov
Have you tested the following pages?
BaseWeb