Fix workspace name not updating in real time in Recent Chats#86298
Conversation
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.
|
|
@situchan, I've addressed the AI feedback, pr is ready for your review. Please take a look when you get a chance. thanks. |
Code ReviewOverall: The approach is sound — subscribe to policy changes via Observations1. The two pre-existing effects (report changes ~line 128 and report action changes ~line 157) now call // Report changes effect deps:
[changedReportsEntries, personalDetails, currentUserAccountID, reports, allPolicies, reportAttributes?.reports, privateIsArchivedMap]
// Report actions effect deps:
[changedReportActions, personalDetails, currentUserAccountID, reports, allPolicies, reportAttributes?.reports, privateIsArchivedMap]This isn't a correctness bug since the callback's underlying dependencies ( 2. Policy effect fires on The new policy effect's dependency array includes [changedPolicies, reports, allPolicies, prevPolicies, getReprocessedReportOption]
3. Changing from lazy 4. Only tracking policy The effect at line ~206 only filters for Minor nitThe SummaryThe PR correctly solves the issue of workspace names not updating in real-time in Recent Chats. The code is well-structured with appropriate guard clauses and early returns. Points 1 and 2 above are the only items I'd suggest addressing — point 1 for lint compliance, point 2 as an optional performance consideration. |
| if (!prevOptions.current) { | ||
| prevOptions.current = optionsList; | ||
| setInternalOptions(optionsList); | ||
| setAreInternalOptionsInitialized(areOptionsInitialized); | ||
| return; | ||
| } |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safaritest1.movtest2.mov |
|
@situchan I addressed the remaining review comments and the stale workspace-room alternate text issue in Search. Could you please take another review pass when you have time? I also recorded a demo of the fix here: alternate-text-real-time-updates.mp4 |
Code Review (Round 2 — updated commits)Three new commits since the last review: dependency array fix, stale alternate text fix, and test updates. All CI checks pass. What was addressed from Round 1
New:
|
| const keyForList = option.keyForList ?? option.reportID ?? (option.accountID ? String(option.accountID) : undefined); | ||
| const isReportArchived = !!privateIsArchivedMap[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${option.reportID}`]; | ||
| const policyName = policies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]?.name; | ||
| const updatedWorkspaceRoomFallback = getUpdatedWorkspaceRoomFallback(option, report, policyName, isReportArchived); |
There was a problem hiding this comment.
I don't like this approach of updating subtitle and alternateText manually.
What was the root cause?
Whenever policy name is changed, options are recalculated. Then why does this bug happen?
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8772439e3b
ℹ️ 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".
| } | ||
|
|
||
| function getUpdatedWorkspaceRoomFallback(option: AutocompleteListItem, report: OnyxEntry<Report>, policyName: string | undefined, isReportArchived: boolean) { | ||
| if (!report || !option.subtitle || option.alternateText !== option.subtitle || (!isDefaultRoom(report) && !isUserCreatedPolicyRoom(report))) { |
There was a problem hiding this comment.
Distinguish message previews from fallback subtitles
The new fallback path treats option.alternateText === option.subtitle as proof that the row is using a workspace-name fallback, but in chat finder alternateText can also be a real last-message preview. If the latest message text happens to equal the subtitle (for example, someone sends a message matching the workspace name), this condition is true and a policy rename will overwrite that valid preview with the workspace name, so Recent Chats shows incorrect secondary text until a new message arrives.
Useful? React with 👍 / 👎.
|
working on it |
|
@situchan Thanks for the review. I updated the fix based on your feedback, removed the previous approach, and addressed the remaining comments. Could you please take another look when you have time? |
|
Conflict solved |
|
🤖 Code Review Overall this is a well-structured change. The approach of watching 1. The PR adds 2. Policy effect dependency on The new }, [changedPolicies, reports, allPolicies, prevPolicies, getReprocessedReportOption]);This means the effect re-runs whenever any report changes (e.g., new message received), not just when policies change. The guard clause 3. Test coverage could be broader The new test covers the core happy path (single report, single policy rename). Consider adding cases for:
4. Minor: if (reportOption) {
updatedReportsMap.set(reportID, reportOption);
} else {
updatedReportsMap.delete(reportID);
}The Everything else looks good — the |
| if ( | ||
| aReport?.reportID !== bReport?.reportID || | ||
| aReport?.text !== bReport?.text || | ||
| aReport?.alternateText !== bReport?.alternateText || | ||
| aReport?.subtitle !== bReport?.subtitle || | ||
| aReport?.lastMessageText !== bReport?.lastMessageText |
|
Codex Review: Didn't find any major issues. Another round soon, please! ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
|
🚧 @flodnv 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! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/flodnv in version: 9.3.53-0 🚀
Bundle Size Analysis (Sentry): |
|
No help site changes are required for this PR. This is a purely internal bug fix — it makes workspace name changes reflect immediately in Search > Recent Chats. No new UI, features, settings, or terminology were introduced. I reviewed all relevant docs under
The fix simply makes the app behave as the documentation already describes. No doc updates needed. |
|
🚀 Deployed to staging by https://github.com/flodnv in version: 9.3.53-0 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.3.53-7 🚀
|


Explanation of Change
Search > Recent Chats now updates those workspace room names as soon as the workspace name changes, so users see the new name immediately without needing to reload or wait for another update.
Fixed Issues
$ #79884
PROPOSAL: #79884 (comment)
Tests
#announceroom name#announceroom name in recent chatsOffline tests
Same as Tests.
QA Steps
Same as Tests.
// TODO: These must be filled out, or the issue title must include "[No QA]."
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
Android: Native
Screen.Recording.2026-03-25.at.9.47.04.AM.mov
Android: mWeb Chrome
Screen.Recording.2026-03-25.at.9.50.34.AM.mov
iOS: Native
Screen.Recording.2026-03-25.at.9.56.59.AM.mov
iOS: mWeb Safari
Screen.Recording.2026-03-25.at.9.53.50.AM.mov
MacOS: Chrome / Safari
MacOS.web.mp4