[Domain Control] [Release 4] Add Preferred Workspace to DomainGroupDetailsPage#88703
Conversation
…/domains/group-preferred-workspace # Conflicts: # src/pages/domain/Groups/DomainGroupDetailsPage.tsx
…/domains/group-preferred-workspace
…/domains/group-preferred-workspace # Conflicts: # src/languages/en.ts
…/domains/group-preferred-workspace
…/domains/group-preferred-workspace # Conflicts: # src/pages/domain/Groups/DomainGroupDetailsPage.tsx # src/selectors/Policy.ts
…/domains/group-preferred-workspace # Conflicts: # src/pages/domain/Groups/DomainGroupDetailsPage.tsx # src/selectors/Policy.ts # src/types/onyx/DomainErrors.ts # src/types/onyx/DomainPendingActions.ts
…ain security groups
…om:software-mansion-labs/expensify-app-fork into war-in/domains/group-preferred-workspace, replace HTMLMessageRow with generic ErrorMessageRow in PreferredWorkspaceToggle
|
Hey, I noticed you changed If you want to automatically generate translations for other locales, an Expensify employee will have to:
Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running: npx ts-node ./scripts/generateTranslations.ts --helpTypically, you'd want to translate only what you changed by running |
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 62d199d20e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| ...(enabled && | ||
| !preferredPolicyID && | ||
| firstAdminPolicy?.id && { | ||
| restrictedPrimaryPolicyID: firstAdminPolicy?.id, |
There was a problem hiding this comment.
Split multi-field toggle update to preserve rollback correctness
This toggle update sends both enableRestrictedPrimaryPolicy and restrictedPrimaryPolicyID in one updateDomainSecurityGroup() call, but the action tracks rollback by a single settingsName (enableRestrictedPrimaryPolicy). If the write is rejected, updateDomainSecurityGroup() only reverts that one field, so the optimistic restrictedPrimaryPolicyID can remain stale in Onyx and the UI shows a preferred workspace that was never persisted.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
I think it's fine because we send the default workspace here and it's shown by default anyway, so there will be no visible change
| switchAccessibilityLabel={translate('domain.groups.preferredWorkspace')} | ||
| shouldPlaceSubtitleBelowSwitch | ||
| isActive={isEnabled} | ||
| disabled={!hasAdminPolicies} |
There was a problem hiding this comment.
Keep the toggle usable when restriction is already enabled
The switch is fully disabled whenever hasAdminPolicies is false, which blocks both enabling and disabling. In the case where this setting is already on and the admin later has no admin workspaces (e.g., role/workspace changes), the UI no longer allows turning the restriction off, leaving the group stuck in that state from this page.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Good catch! I'll add && !isEnabled to that condition
| if (!group) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
I suppose this condition should be at the top
|
The default workspace is not selected when I open the preferred workspace for the first time 2026-04-27.13.48.57.mov |
I verified the data in onyx and it looks like this happens when you don't have access to this workspace. Probably someone set the preferred workspace to something and now it's showing you the first one due to this condition title={preferredPolicyName ?? firstAdminPolicy?.name}I was able to reproduce this behaviour in OD too |
I think this one might be caused by the same reason |
|
There's conflict |
…rkspace # Conflicts: # src/languages/de.ts # src/languages/en.ts # src/languages/es.ts # src/languages/fr.ts # src/languages/it.ts # src/languages/ja.ts # src/languages/nl.ts # src/languages/pl.ts # src/languages/pt-BR.ts # src/languages/zh-hans.ts # src/pages/domain/Groups/DomainGroupDetailsPage.tsx # src/types/onyx/DomainErrors.ts # src/types/onyx/DomainPendingActions.ts
|
@situchan conflicts resolved |
|
Regarding the behavior @ZhenjaHorbach found, it was concluded in this Slack discussion to move forward with the current PR. Since the bug also exists on Classic, we will address it in a follow-up PR. 😄 |
…rkspace # Conflicts: # src/languages/de.ts # src/languages/en.ts # src/languages/es.ts # src/languages/fr.ts # src/languages/it.ts # src/languages/ja.ts # src/languages/nl.ts # src/languages/pl.ts # src/languages/pt-BR.ts # src/languages/zh-hans.ts # src/libs/actions/Domain.ts # src/pages/domain/Groups/DomainGroupDetailsPage.tsx # src/types/onyx/DomainErrors.ts
…preferred-workspace
| import type SCREENS from '@src/SCREENS'; | ||
|
|
||
| type WorkspaceListItem = { | ||
| policyID: string; |
|
|
||
| const policyNameSelector = (policy: OnyxEntry<Policy>) => policy?.name; | ||
|
|
||
| const createAdminPoliciesSelector = |
There was a problem hiding this comment.
@TMisiukiewicz i wonder how does this one do from performance perspective. We saw that when the selector is a bit more complex it was actually better to just select all policies and do the filtering later
There was a problem hiding this comment.
As always... It depends 😅 for small admin sets the selector path is fine, but on accounts with lots of admin policies the deepEqual overhead can outweigh what the selector saves. It narrows down the collection and structure of the object, so I'd say we don't have to pre-optimize without evidence that it's slowing things down
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 @mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.3.67-0 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.3.67-13 🚀
|

Explanation of Change
Add
Preferred Workspacesetting for Domain Security Group RHP.Fixed Issues
$ #80134
PROPOSAL:
Tests
Preconditions:
/domains/<domainAccountID>/groupsPreferred Workspaceto trueOffline tests
N/A
QA Steps
Same as Tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
iOS: Native
MacOS: Chrome / Safari
Screen.Recording.2026-04-24.at.13.37.46.mov
Screen.Recording.2026-04-24.at.13.38.30.mov