You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Option to add "New domain" is not displayed #79508
Version Number: 9.3.0-5 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: Applause Internal Team Slack conversation (hyperlinked to channel name): #QA Channel
Action Performed:
Login with an account who has not claimed the domain associated with their private email
Navigate to the “Workspaces” tab
Click on the “New” button in the top right corner
Expected Result:
Option to add a new workspace or a new domain
Actual Result:
New Workspace button is displayed, but clicking it does not show the New Domain option.## Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
Please re-state the problem that we are trying to solve in this issue.
When a user with a private email domain (e.g., user@company.com) navigates to the Workspaces tab and clicks the "New" button, they only see the "New Workspace" option. The "New domain" option is not displayed, even though they should be able to claim and verify their email domain.
What is the root cause of that problem?
In src/pages/workspace/WorkspacesListPage.tsx:695, the shouldShowNewDomainButton prop is set to !!domains.length:
<WorkspacesListPageHeaderButtonshouldShowNewWorkspaceButton={!isRestrictedPolicyCreation&&(!!domains.length||!!workspaces.length)}shouldShowNewDomainButton={!!domains.length}// <-- Bug: only true if user already has domains/>
This condition only evaluates to true if the user already has claimed domains. Users with private email domains who haven't claimed any domain yet will have domains.length === 0, so the "New domain" option never appears for them.
What changes do you think we should make in order to solve the problem?
The condition should also check if the user has a private email domain (i.e., not from a public domain like gmail.com). The account object is already available in the component (line 147) and contains isFromPublicDomain.
Users with existing domains see the option (existing behavior)
Users with private email domains (who can claim their domain) also see the option
What alternative solutions did you explore? (Optional)
Always show the "New domain" option - Rejected because users on public domains (gmail.com, etc.) cannot claim domains, so showing them the option would lead to a confusing UX.
Check in AddDomainPage - The page could redirect public domain users, but it's better UX to not show the option at all if the user can't use it.
Please re-state the problem that we are trying to solve in this issue.
Users with work/company email addresses cannot see the "New domain" option when clicking the "New" button in the Workspaces tab. Only the "New Workspace" option appears, preventing them from claiming their company domain.
What is the root cause of that problem?
The visibility of the "New domain" button is controlled in src/pages/workspace/WorkspacesListPage.tsx at line 695:
shouldShowNewDomainButton={!!domains.length}
This checks if the user has existing domains. First-time users wanting to claim their domain have zero domains, so the button never shows for them.
What changes do you think we should make in order to solve the problem?
Introduce a dedicated hook to determine domain eligibility based on the user's email type. This centralizes the logic and can be reused wherever domain access needs to be checked.
3. Optionally update src/components/DomainsEmptyStateComponent.tsx to hide for public domain users:
+ import useCanAddDomain from '@hooks/useCanAddDomain';
function DomainsEmptyStateComponent() {
+ const canAddDomain = useCanAddDomain();+ if (!canAddDomain) {+ return null;+ }
What alternative solutions did you explore? (Optional)
Pass eligibility from parent component - Could thread isFromPublicDomain down from a parent, but this adds prop drilling and the hook pattern is cleaner.
Check in WorkspacesListPageHeaderButton directly - Moving the Onyx subscription into the button component would work, but violates separation of concerns since the parent should control visibility.
Modify DomainsEmptyStateComponent to always render the button - The empty state already has an "Enable" button, but relying solely on that is inconsistent with the header button UX pattern used elsewhere.
Please re-state the problem that we are trying to solve in this issue.
New Workspace button is displayed in the Workspaces tab, but clicking it does not show the New Domain option for users who have not claimed the domain associated with their private email.
What is the root cause of that problem?
The issue is in the WorkspacesListPage.tsx where the shouldShowNewDomainButton prop is passed to WorkspacesListPageHeaderButton. The current logic only shows the "New Domain" option if the user already has at least one claimed domain:
The problem is shouldShowNewDomainButton={!!domains.length} - this evaluates to false when the user has zero domains, which prevents users with private email domains from seeing the option to claim their domain.
Looking at the WorkspacesListPageHeaderButton component, we can see the conditional logic:
When shouldShowNewDomainButton is false, only the "New Workspace" button is shown instead of the dropdown menu with both options.
What changes do you think we should make in order to solve the problem?
The fix should check if the user has a private email domain (not a public domain like gmail.com, outlook.com, etc.) and show the "New Domain" option accordingly. Users with private email domains should be able to claim their domain even if they haven't claimed any domains yet.
// After// Users with a private email domain should be able to see the "New Domain" option// even if they haven't claimed any domains yetconstcurrentUserEmail=currentUserPersonalDetails?.login??'';consthasPrivateEmailDomain=!!currentUserEmail&&!isEmailPublicDomain(currentUserEmail);constheaderButton=(<WorkspacesListPageHeaderButtonshouldShowNewWorkspaceButton={!isRestrictedPolicyCreation&&(!!domains.length||!!workspaces.length)}shouldShowNewDomainButton={!!domains.length||hasPrivateEmailDomain}/>);
How the fix works:
We import the isEmailPublicDomain utility from @libs/LoginUtils which checks if an email belongs to a public domain (like gmail.com, yahoo.com, etc.)
We get the current user's email from currentUserPersonalDetails?.login
We calculate hasPrivateEmailDomain which is true if:
The user has an email, AND
The email is NOT from a public domain
We update shouldShowNewDomainButton to be true when:
The user already has domains (!!domains.length), OR
The user has a private email domain (hasPrivateEmailDomain)
this is exactly what it was decided to be like when we implemented the feature (#76231 (comment)). the flow is accessible through the "Enable" button in the domain section security banner
Activity
melvin-bot commentedon Jan 13, 2026
Triggered auto assignment to @twisterdotcom (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.MobileMage commentedon Jan 13, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user with a private email domain (e.g.,
user@company.com) navigates to the Workspaces tab and clicks the "New" button, they only see the "New Workspace" option. The "New domain" option is not displayed, even though they should be able to claim and verify their email domain.What is the root cause of that problem?
In
src/pages/workspace/WorkspacesListPage.tsx:695, theshouldShowNewDomainButtonprop is set to!!domains.length:This condition only evaluates to
trueif the user already has claimed domains. Users with private email domains who haven't claimed any domain yet will havedomains.length === 0, so the "New domain" option never appears for them.What changes do you think we should make in order to solve the problem?
The condition should also check if the user has a private email domain (i.e., not from a public domain like gmail.com). The
accountobject is already available in the component (line 147) and containsisFromPublicDomain.Diff:
const headerButton = ( <WorkspacesListPageHeaderButton shouldShowNewWorkspaceButton={!isRestrictedPolicyCreation && (!!domains.length || !!workspaces.length)} - shouldShowNewDomainButton={!!domains.length} + shouldShowNewDomainButton={!!domains.length || !account?.isFromPublicDomain} /> );This ensures:
What alternative solutions did you explore? (Optional)
Always show the "New domain" option - Rejected because users on public domains (gmail.com, etc.) cannot claim domains, so showing them the option would lead to a confusing UX.
Check in AddDomainPage - The page could redirect public domain users, but it's better UX to not show the option at all if the user can't use it.
duckemiah commentedon Jan 13, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Users with work/company email addresses cannot see the "New domain" option when clicking the "New" button in the Workspaces tab. Only the "New Workspace" option appears, preventing them from claiming their company domain.
What is the root cause of that problem?
The visibility of the "New domain" button is controlled in
src/pages/workspace/WorkspacesListPage.tsxat line 695:This checks if the user has existing domains. First-time users wanting to claim their domain have zero domains, so the button never shows for them.
What changes do you think we should make in order to solve the problem?
Introduce a dedicated hook to determine domain eligibility based on the user's email type. This centralizes the logic and can be reused wherever domain access needs to be checked.
1. Add
src/hooks/useCanAddDomain.ts:2. Modify
src/pages/workspace/WorkspacesListPage.tsx:3. Optionally update
src/components/DomainsEmptyStateComponent.tsxto hide for public domain users:What alternative solutions did you explore? (Optional)
Pass eligibility from parent component - Could thread
isFromPublicDomaindown from a parent, but this adds prop drilling and the hook pattern is cleaner.Check in
WorkspacesListPageHeaderButtondirectly - Moving the Onyx subscription into the button component would work, but violates separation of concerns since the parent should control visibility.Modify
DomainsEmptyStateComponentto always render the button - The empty state already has an "Enable" button, but relying solely on that is inconsistent with the header button UX pattern used elsewhere.abbasifaizan70 commentedon Jan 13, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
New Workspace button is displayed in the Workspaces tab, but clicking it does not show the New Domain option for users who have not claimed the domain associated with their private email.
What is the root cause of that problem?
The issue is in the
WorkspacesListPage.tsxwhere theshouldShowNewDomainButtonprop is passed toWorkspacesListPageHeaderButton. The current logic only shows the "New Domain" option if the user already has at least one claimed domain:App/src/pages/workspace/WorkspacesListPage.tsx
Lines 687 to 692 in 95e0df2
The problem is
shouldShowNewDomainButton={!!domains.length}- this evaluates tofalsewhen the user has zero domains, which prevents users with private email domains from seeing the option to claim their domain.Looking at the
WorkspacesListPageHeaderButtoncomponent, we can see the conditional logic:App/src/pages/workspace/WorkspacesListPageHeaderButton.tsx
Lines 26 to 51 in 95e0df2
When
shouldShowNewDomainButtonisfalse, only the "New Workspace" button is shown instead of the dropdown menu with both options.What changes do you think we should make in order to solve the problem?
The fix should check if the user has a private email domain (not a public domain like gmail.com, outlook.com, etc.) and show the "New Domain" option accordingly. Users with private email domains should be able to claim their domain even if they haven't claimed any domains yet.
File:
App/src/pages/workspace/WorkspacesListPage.tsxisEmailPublicDomain:App/src/pages/workspace/WorkspacesListPage.tsx
Lines 63 to 64 in 95e0df2
shouldShowNewDomainButtonlogic:App/src/pages/workspace/WorkspacesListPage.tsx
Lines 687 to 692 in 95e0df2
How the fix works:
We import the
isEmailPublicDomainutility from@libs/LoginUtilswhich checks if an email belongs to a public domain (like gmail.com, yahoo.com, etc.)We get the current user's email from
currentUserPersonalDetails?.loginWe calculate
hasPrivateEmailDomainwhich istrueif:We update
shouldShowNewDomainButtonto betruewhen:!!domains.length), ORhasPrivateEmailDomain)mhawryluk commentedon Jan 14, 2026
this is exactly what it was decided to be like when we implemented the feature (#76231 (comment)). the flow is accessible through the "Enable" button in the domain section security banner
mountiny commentedon Jan 14, 2026
Thanks @mhawryluk ! That looks right, my bad 🙇
@m-natarajan Can you please make sure to update the test case to clarify that expectation
m-natarajan commentedon Jan 14, 2026
@mountiny Updated the test case steps
mountiny commentedon Jan 14, 2026
Thank you