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
Chat - Unable to add to group user when previously have offline conversation with #81693
Please re-state the problem that we are trying to solve in this issue.
When a user creates a 1:1 chat while offline and later goes online, starting a new chat (FAB → Start chat) shows the existing DM in the list/RHP but does not show the “Add to group” button next to that user. This prevents quickly turning that DM into a group chat from the start-chat flow.
What is the root cause of that problem?
The “Add to group” button in NewChatPage is only rendered when the option has a login. If login is missing, the right-side component returns null, so the button never appears:
In the offline-created DM case, the “recent report” option can be built without a matching PersonalDetails entry for the other participant yet. In createOption(), login and accountID are only set from the matched personalDetail. If that lookup fails, login stays undefined (and accountID remains the default 0), which makes the UI treat the option as “not a person you can add”, even though we do have a participant accountID from the report:
What changes do you think we should make in order to solve the problem?
Update createOption() to always set accountID for single-participant (DM) report options from accountIDs[0] even when personalDetail isn’t available yet. This preserves an identity we can safely use in selection/group-draft flows until personal details arrive.
Update NewChatPage’s itemRightSideComponent to allow showing “Add to group” when we have a valid accountID, even if login is temporarily missing.
Update toggleOption() to remove selections using accountID when login is missing, so selecting/unselecting works consistently for these transient options.
// Initialize only the properties that are actually used in SearchOption context
constresult: SearchOptionData={
// Core identification - used in SearchOption context
// We use empty string as a default for reportID as in many places the application uses conditional checks that test for reportID existence with truthiness operators
// Set login and accountID only for single participant cases (used in SearchOption context)
// Also always set for personal details options (showPersonalDetails: true) to ensure search filtering works correctly
if (showPersonalDetails || (!hasMultipleParticipants && (!report || (report && !reportUtilsIsGroupChat(report) && !reportUtilsIsChatRoom(report))))) {
result.login = personalDetail?.login;
result.accountID = personalDetail?.accountID ? Number(personalDetail.accountID) : Number(accountIDs.at(0));
}
What alternative solutions did you explore? (Optional)
Recomputing missing login for DM report options from other Onyx sources (e.g., login lists) isn’t reliable because ONYXKEYS.LOGIN_LIST is keyed by login and doesn’t provide an accountID → login mapping.
Fetching/forcing personal details hydration before rendering the start-chat list would add latency and still risk timing races; falling back to a stable accountID is simpler and keeps the UI responsive.
Please re-state the problem that we are trying to solve in this issue.
When a user creates a 1:1 direct message while offline, then comes back online and navigates to "Start chat", the "Add to group" button is missing for that user, even though they should be addable to a group since they have an existing 1:1 DM.
What is the root cause of that problem?
When a 1:1 DM is created optimistically (while offline), the buildOptimisticChatReport function sets policyID to CONST.POLICY.OWNER_EMAIL_FAKE which equals '__FAKE__':
Because '__FAKE__' is neither '_FAKE_' nor falsy, isOneOnOneChat() incorrectly returns false for offline-created DMs. This causes the current user to not be excluded from the participant list (since the exclusion logic depends on isOneOnOneChat returning true):
An alternative would be to change buildOptimisticChatReport to use CONST.POLICY.ID_FAKE instead of CONST.POLICY.OWNER_EMAIL_FAKE, but this could have unintended side effects elsewhere in the codebase where OWNER_EMAIL_FAKE might be expected. The proposed fix is safer as it makes isOneOnOneChat handle both fake policy constants consistently.
Please re-state the problem that we are trying to solve in this issue.
When a user creates a 1:1 chat while offline and then goes online, opening “Start chat” (FAB → Start chat) shows the existing DM in the list/RHP, but it does not show the “Add to group” button next to that user; expected is that “Add to group” is shown so the user can convert the DM into a group chat, but the button is missing.
What is the root cause of that problem?
In this flow, ReportUtils.ts classifies policy-less 1:1 chats with an assumption that only CONST.POLICY.ID_FAKE or a falsy policyID can represent them, but offline optimistic 1:1 DMs are created with policyID = CONST.POLICY.OWNER_EMAIL_FAKE in buildOptimisticChatReport() (ReportUtils.ts, line 7672), so isOneOnOneChat() (src/libs/ReportUtils.ts, lines 2713–2714) returns false for these reports, which causes downstream participant display logic to treat the chat as multi-participant and produce an option without login/accountID, and then the right-side action does not render because it depends on item.login.
What changes do you think we should make in order to solve the problem?
Fix the earliest root cause in the layer that owns it by expanding 1:1 chat classification in ReportUtils.ts to treat CONST.POLICY.OWNER_EMAIL_FAKE the same as CONST.POLICY.ID_FAKE and falsy policyID, and keep buildOptimisticChatReport() unchanged because other code depends on OWNER_EMAIL_FAKE.
After this, isOneOnOneChat() becomes true for offline-created 1:1 DMs, the current user is excluded from the participant list, the option becomes a single-participant option with login/accountID, and “Add to group” is shown.
What alternative solutions did you explore? (Optional)
Changing buildOptimisticChatReport() to use ID_FAKE: It would match the existing checks, but other code (e.g. ModifiedExpenseMessage.ts, usePolicy.ts) explicitly depends on OWNER_EMAIL_FAKE, so changing it increases the blast radius and can cause regressions. Keeping OWNER_EMAIL_FAKE at creation time and expanding the reader-side classification is safer.
UI or OptionsListUtils fallbacks for missing login/accountID: This would hide the real problem by compensating for misclassified reports and would duplicate responsibility; fixing classification where it belongs keeps the behavior consistent.
@trjExpensify I'm not aware of the search in start chat.
Should we enable to show the results when we search offline (FAB > Start chat > Search user) and when the search term (typed by user) option isn't there in local cache then should we show the result?
Because showing the result from local cache when offline make sense, but (while offline) showing the results which aren't in cache is what I have doubt.
Also if a user exist in the backend but after searching offline, it won't show the result from backend so it creates a user to invite but user exist already. That also seems to doubtful to me.
This issue has not been updated in over 15 days. @rojiphil, @johncschuster eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
Activity
melvin-bot commentedon Feb 6, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rojiphil (
External)melvin-bot commentedon Feb 6, 2026
Triggered auto assignment to @johncschuster (
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.annaweber830 commentedon Feb 6, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user creates a 1:1 chat while offline and later goes online, starting a new chat (FAB → Start chat) shows the existing DM in the list/RHP but does not show the “Add to group” button next to that user. This prevents quickly turning that DM into a group chat from the start-chat flow.
What is the root cause of that problem?
The “Add to group” button in
NewChatPageis only rendered when the option has alogin. Ifloginis missing, the right-side component returnsnull, so the button never appears:App/src/pages/NewChatPage.tsx
Lines 400 to 403 in c6feaa4
In the offline-created DM case, the “recent report” option can be built without a matching
PersonalDetailsentry for the other participant yet. IncreateOption(),loginandaccountIDare only set from the matchedpersonalDetail. If that lookup fails,loginstaysundefined(andaccountIDremains the default0), which makes the UI treat the option as “not a person you can add”, even though we do have a participant accountID from the report:App/src/libs/OptionsListUtils/index.ts
Lines 995 to 1002 in c6feaa4
What changes do you think we should make in order to solve the problem?
createOption()to always setaccountIDfor single-participant (DM) report options fromaccountIDs[0]even whenpersonalDetailisn’t available yet. This preserves an identity we can safely use in selection/group-draft flows until personal details arrive.NewChatPage’sitemRightSideComponentto allow showing “Add to group” when we have a validaccountID, even ifloginis temporarily missing.toggleOption()to remove selections usingaccountIDwhenloginis missing, so selecting/unselecting works consistently for these transient options.App/src/pages/NewChatPage.tsx
Lines 400 to 433 in c6feaa4
App/src/pages/NewChatPage.tsx
Lines 318 to 349 in c6feaa4
App/src/libs/OptionsListUtils/index.ts
Lines 865 to 1003 in c6feaa4
What alternative solutions did you explore? (Optional)
loginfor DM report options from other Onyx sources (e.g., login lists) isn’t reliable becauseONYXKEYS.LOGIN_LISTis keyed by login and doesn’t provide an accountID → login mapping.accountIDis simpler and keeps the UI responsive.twilight2294 commentedon Feb 6, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user creates a 1:1 direct message while offline, then comes back online and navigates to "Start chat", the "Add to group" button is missing for that user, even though they should be addable to a group since they have an existing 1:1 DM.
What is the root cause of that problem?
When a 1:1 DM is created optimistically (while offline), the
buildOptimisticChatReportfunction setspolicyIDtoCONST.POLICY.OWNER_EMAIL_FAKEwhich equals'__FAKE__':https://github.com/Expensify/App/blob/main/src/libs/ReportUtils.ts#L7672
However, the
isOneOnOneChat()function only checks forCONST.POLICY.ID_FAKE(which equals'_FAKE_') or falsy values:https://github.com/Expensify/App/blob/main/src/libs/ReportUtils.ts#L2713-L2714
Because
'__FAKE__'is neither'_FAKE_'nor falsy,isOneOnOneChat()incorrectly returnsfalsefor offline-created DMs. This causes the current user to not be excluded from the participant list (since the exclusion logic depends onisOneOnOneChatreturningtrue):https://github.com/Expensify/App/blob/main/src/libs/ReportUtils.ts#L3458
With both participants in the list,
hasMultipleParticipantsbecomestrueincreateOption, which prevents theloginfield from being set:https://github.com/Expensify/App/blob/main/src/libs/OptionsListUtils/index.ts#L997-L1000
Finally, without a
loginvalue on the option, the "Add to group" button is not rendered:https://github.com/Expensify/App/blob/main/src/pages/NewChatPage.tsx#L401
What changes do you think we should make in order to solve the problem?
Update the
isOneOnOneChatfunction to also recognizeCONST.POLICY.OWNER_EMAIL_FAKEas a valid indicator of a policy-less 1:1 chat:https://github.com/Expensify/App/blob/main/src/libs/ReportUtils.ts#L2713-L2714
For consistency, also update the same check on line 1911:
https://github.com/Expensify/App/blob/main/src/libs/ReportUtils.ts#L1911
What alternative solutions did you explore?
An alternative would be to change
buildOptimisticChatReportto useCONST.POLICY.ID_FAKEinstead ofCONST.POLICY.OWNER_EMAIL_FAKE, but this could have unintended side effects elsewhere in the codebase whereOWNER_EMAIL_FAKEmight be expected. The proposed fix is safer as it makesisOneOnOneChathandle both fake policy constants consistently.yatin-italy commentedon Feb 7, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user creates a 1:1 chat while offline and then goes online, opening “Start chat” (FAB → Start chat) shows the existing DM in the list/RHP, but it does not show the “Add to group” button next to that user; expected is that “Add to group” is shown so the user can convert the DM into a group chat, but the button is missing.
What is the root cause of that problem?
In this flow, ReportUtils.ts classifies policy-less 1:1 chats with an assumption that only
CONST.POLICY.ID_FAKEor a falsypolicyIDcan represent them, but offline optimistic 1:1 DMs are created withpolicyID = CONST.POLICY.OWNER_EMAIL_FAKEinbuildOptimisticChatReport()(ReportUtils.ts, line 7672), soisOneOnOneChat()(src/libs/ReportUtils.ts, lines 2713–2714) returns false for these reports, which causes downstream participant display logic to treat the chat as multi-participant and produce an option withoutlogin/accountID, and then the right-side action does not render because it depends onitem.login.What changes do you think we should make in order to solve the problem?
Fix the earliest root cause in the layer that owns it by expanding 1:1 chat classification in
ReportUtils.tsto treatCONST.POLICY.OWNER_EMAIL_FAKEthe same asCONST.POLICY.ID_FAKEand falsypolicyID, and keepbuildOptimisticChatReport()unchanged because other code depends onOWNER_EMAIL_FAKE.After this,
isOneOnOneChat()becomes true for offline-created 1:1 DMs, the current user is excluded from the participant list, the option becomes a single-participant option withlogin/accountID, and “Add to group” is shown.What alternative solutions did you explore? (Optional)
Changing
buildOptimisticChatReport()to useID_FAKE: It would match the existing checks, but other code (e.g.ModifiedExpenseMessage.ts,usePolicy.ts) explicitly depends onOWNER_EMAIL_FAKE, so changing it increases the blast radius and can cause regressions. KeepingOWNER_EMAIL_FAKEat creation time and expanding the reader-side classification is safer.UI or
OptionsListUtilsfallbacks for missinglogin/accountID: This would hide the real problem by compensating for misclassified reports and would duplicate responsibility; fixing classification where it belongs keeps the behavior consistent.Uzaifm127 commentedon Feb 9, 2026
This issue isn't only about Add to group button.
We have incorrect optimistic data conflicting in the app when coming back online.
Note:
uzafim127+5@gmail.comis exist in the app, it isn't the account which is new or which we need to invite.issue.mp4
Uzaifm127 commentedon Feb 9, 2026
@trjExpensify I'm not aware of the search in start chat.
Should we enable to show the results when we search offline (FAB > Start chat > Search user) and when the search term (typed by user) option isn't there in local cache then should we show the result?
Because showing the result from local cache when offline make sense, but (while offline) showing the results which aren't in cache is what I have doubt.
Also if a user exist in the backend but after searching offline, it won't show the result from backend so it creates a user to invite but user exist already. That also seems to doubtful to me.
Screen.Recording.2026-02-09.at.11.mp4
55 remaining items
melvin-bot commentedon Jul 15, 2026
This issue has not been updated in over 15 days. @rojiphil, @johncschuster eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
melvin-bot commentedon Jul 23, 2026
@rojiphil Whoops! This issue is 2 days overdue. Let's get this updated quick!
rojiphil commentedon Jul 24, 2026
@johncschuster Can we close this issue please since the issue is not reproducible ?
mvtglobally commentedon Jul 25, 2026
Issue not reproducible during KI retests. (Third week)
melvin-bot commentedon Jul 27, 2026
@rojiphil Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!