Reject non-normalized primary names across profile UI#1146
Merged
laurgk merged 10 commits intoJun 24, 2026
Merged
Conversation
Deploying ens-app-v3 with
|
| Latest commit: |
2584246
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://6e00ab20.ens-app-v3.pages.dev |
| Branch Preview URL: | https://feature-web-532-bug-non-norm.ens-app-v3.pages.dev |
There was a problem hiding this comment.
Pull request overview
This PR tightens primary-name handling across the UI by treating non-normalized reverse records as invalid and centralizing “should we display a primary name vs fall back to address” logic.
Changes:
- Add
primaryNameUtilshelpers (hasValidPrimaryName,getPrimaryDisplayName) and adopt them across profile/wallet/transaction UI. - Enforce normalization/validation in primary-name resolution (including raw reverse-name normalization checks and forward-resolution verification).
- Update unit tests to cover unnormalized raw reverse names.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/transaction-flow/input/EditRoles/hooks/useSimpleSearch.ts | Adds normalization validation for address → name search results (now includes an extra reverse read). |
| src/pages/profile.tsx | Uses hasValidPrimaryName so self-profile falls back to address when primary is invalid. |
| src/hooks/reverseRecord/usePrimaryNameOrAddress.ts | Centralizes display-name selection via primaryNameUtils and falls back to shortened address. |
| src/hooks/primary/queries/getPrimaryNameQuery.ts | Rejects non-normalized reverse names and verifies forward resolution matches the address. |
| src/hooks/pages/profile/[name]/profile/useProfileActions/useProfileActions.ts | Prevents invalid primary names from affecting “available primary name” logic. |
| src/hooks/ensjs/public/usePrimaryName.ts | Adds raw reverse-name normalization check (via Universal Resolver) and returns null when invalid by default. |
| src/hooks/ensjs/public/usePrimaryName.test.ts | Adds coverage for rejecting unnormalized raw reverse names; updates mocks. |
| src/hooks/ensjs/public/primaryNameUtils.ts | Introduces shared helpers for validating and displaying primary names. |
| src/components/TabBar.tsx | Only treats primary name as present when validated. |
| src/components/pages/profile/settings/PrimarySection/PrimarySection.tsx | Gates primary-name UI paths behind hasValidPrimaryName. |
| src/components/pages/profile/ProfileButton.tsx | Uses getPrimaryDisplayName and validated primary-name gating for profile link + copy actions. |
| src/components/pages/profile/NameSnippet.tsx | Displays validated primary display name (with truncation) instead of always using beautifiedName. |
| src/components/pages/profile/[name]/tabs/ProfileTab.tsx | Updates isPrimary to require a valid primary name. |
| src/components/pages/profile/[name]/tabs/OwnershipTab/sections/RolesSection/components/RoleRow.tsx | Avoids using invalid primary names for explorer/profile actions and avatar identifiers. |
| src/components/pages/profile/[name]/tabs/MoreTab/PrimaryName.tsx | Only shows the “primary” tag when the wallet primary name is valid. |
| src/components/pages/profile/[name]/tabs/MoreTab/Ownership.tsx | Displays owner name via getPrimaryDisplayName with fallback to address. |
| src/components/pages/profile/[name]/registration/Registration.tsx | Uses validated primary-name presence when passing hasPrimaryName. |
| src/components/pages/import/[name]/steps/onchain/ImportTransaction.tsx | Uses getPrimaryDisplayName for invoice owner display. |
| src/components/@molecules/TransactionDialogManager/DisplayItems.tsx | Uses getPrimaryDisplayName to decide address subtitle vs name display. |
| src/components/@molecules/ConnectButton/utils.tsx | Uses hasValidPrimaryName to decide whether to show “My Profile” dropdown entry. |
| src/components/@molecules/ConnectButton/ConnectButton.tsx | Uses getPrimaryDisplayName for header profile ENS label. |
| src/components/@molecules/AvatarWithIdentifier/AvatarWithIdentifier.tsx | Uses getPrimaryDisplayName when primary name is fetched internally. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+46
to
+57
| const name = await getName(client, { address }) | ||
| if (!name?.name || !name.match) return null | ||
|
|
||
| const ensUniversalResolverAddress = client.chain?.contracts?.ensUniversalResolver?.address | ||
| if (!ensUniversalResolverAddress) return null | ||
|
|
||
| const rawNameResult = await readContract(client, { | ||
| address: ensUniversalResolverAddress, | ||
| abi: universalResolverReverseSnippet, | ||
| functionName: 'reverse', | ||
| args: [address, 60n], | ||
| }) |
Remove custom ENS reverse lookup and normalization logic. Rely on `getName` from `@ensdomains/ensjs/public` to correctly resolve and normalize names, addressing issues where non-normalized names could appear.
Updates the address page UI and `usePrimaryProfile` hook to no longer consider or display mismatched primary ENS names. This aligns with the underlying logic that now only returns normalized primary names, preventing unnormalized names from being shown in the profile snippet.
Adjusts primary name descriptions to use present tense "are shown" for normalized names, aligning messaging with current system behavior from WEB-532. Updates the i18n link component key for better specificity and maintainability.
laurgk
approved these changes
Jun 24, 2026
laurgk
approved these changes
Jun 24, 2026
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Testing