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
[$250] Chat - "It´s {Time} for {Name}" label is not displayed above composer on 1:1 chat. #92225
Version Number: 9.3.90-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack:#91416 Email or phone of affected tester (no customers):ibellicotest+2723@gmail.com Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: Motorola MotoG60 / Android 12 (Hybrid app) - Windows 11 / Chrome App Component: Chat Report View
Action Performed:
Open the Expensify app.
Open any 1:1 chat.
Note that no "It´s {Time} for {Name}" label, showing the other user´s time is visible above composer.
Expected Result:
A "It´s {Time} for {Name}" label showing the actual time in the other user´s timezone should be visible above composer in 1:1 chats.
Actual Result:
A "It´s {Time} for {Name}" label showing the actual time in the other user´s timezone is not visible above composer after opening a 1:1 chat.
Regression analysis (medium confidence). The label works in steady state but breaks on a specific async load ordering, which is why it reproduces on a slower hybrid device (MotoG60 / Android 12) but not on a warm web session.
This is a regression introduced by #91416 ("refactor: remove personalDetails from ReportActionsList dependencies"), the same PR this bug was caught QAing. That PR is the only recent change to this code, and a browser repro on current main confirms the label still renders correctly for already-cached 1:1 DMs (Concierge, qa.guide) — so the steady-state logic is fine. The break is in how eligibility is recomputed while data hydrates.
What is the root cause of that problem?
PR #91416 moved the recipient‑local‑time eligibility check out of an inline calculation over the full personal‑details list and into useOnyx selectors that close over asynchronously‑loaded values:
useReportRecipientLocalTime.ts:16 subscribes to PERSONAL_DETAILS_LIST with a selector that closes over report and currentUserAccountID.
ComposerLocalTime.tsx:22 then fetches the recipient via a selector gated on shouldShow ? reportRecipientAccountID : undefined.
Neither useOnyx call passes those closed‑over values in the third dependencies argument. useOnyx's snapshot cache only forces the selector to re‑run when (a) the subscribed key (PERSONAL_DETAILS_LIST) changes, (b) the dependencies array changes, or (c) the selector's function identity changes. Since report / currentUserAccountID are neither the subscribed key nor declared dependencies, a correct recompute relies entirely on React Compiler emitting a new selector reference when those values change. When report (or currentUserAccountID) hydrates across several renders — common on slower devices — the eligibility result gets cached as false and can stay stale, so the label never appears. The shouldShow ? gate then chains the recipient lookup behind that stuck flag, compounding it.
Evidence & mechanism detail
Old code computed canShowReportRecipientLocalTime(personalDetails, report, accountID) inline on every render from the live full list, so it always reflected the current report — no cache contract to get stale.
The eligibility guard itself is unchanged and correct: ReportUtils.ts:3182-3196 (requires exactly one recipient, not a room/expense chat, recipient present, timezone.selected, and validated).
The selector‑cache contract lives in react-native-onyxuseOnyx (OnyxSnapshotCache keys results by selector identity; getSnapshot early‑returns the cached result unless the source value, the dependencies, or the selector identity changed). Passing dependencies explicitly invalidates that cache — which is the pattern other selector call sites in the repo already follow via useMemo + a dependency list.
Browser repro on main: label shows for Concierge ("It's 3:38 PM for Expensify") and qa.guide, and is correctly absent for a user with no selected timezone — confirming steady state works and the failure is load‑order/device‑timing specific (reported platform: Android hybrid).
Test gap: the PR's [useReportRecipientLocalTime.test.ts] covers "personal details load after mount with a stable report", but nothing covers "report (or currentUserAccountID) hydrates after mount" — the exact ordering that regresses.
What changes do you think we should make in order to solve the problem?
Make the selector dependency contract explicit instead of relying on the compiler:
In useReportRecipientLocalTime, build the selector with useMemo keyed on [report, currentUserAccountID] and pass [report, currentUserAccountID] as the third useOnyxdependencies argument.
In ComposerLocalTime, do the same for the recipient selector (key it on the recipient account ID and pass that as dependencies), and drop the shouldShow ? gate at line 22 — the existing isEmptyObject(reportRecipient) guard already handles missing data, so gating the fetch on the eligibility flag is unnecessary and brittle.
Add a regression test for the "report/currentUserAccountID hydrate after mount" ordering so this can't silently regress again.
What alternative solutions did you explore? (Optional)
Revert ComposerLocalTime / useReportRecipientLocalTime to the previous inline computation over usePersonalDetails(). Simplest and definitely correct, but it reintroduces the full‑list subscription that #91416 removed for performance, so the targeted dependencies fix above is preferred.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/92225) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
This appears to be a regression from #91416 — the team may prefer to route it back to that PR's author rather than the contributor flow.
🚨 Edited by proposal-police: This proposal was edited at 2026-06-01 12:51:25 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Opening any 1:1 chat no longer shows the "It's {Time} for {Name}" row above the composer. The row is expected for validated DMs whose recipient has a selected timezone, and it was rendering correctly before the refactor in PR #91416 landed in 9.3.90-0.
What is the root cause of that problem?
PR #91416 (commit fbdeb0d27a2) replaced the inline usePersonalDetails() read in ComposerLocalTime with two independent useOnyx(PERSONAL_DETAILS_LIST, {selector: ...}) subscriptions — one wrapped in a new useReportRecipientLocalTime hook that returns a boolean, and one local subscription that resolves the recipient object. Before the change, both the eligibility check and the recipient lookup ran inline against the samepersonalDetails reference, so they were always consistent within a single render:
The selector is built with personalDetailByAccountIDSelector(undefined) (which always returns undefined) on every render where shouldShow is false, and only switches to personalDetailByAccountIDSelector(reportRecipientAccountID) once useReportRecipientLocalTime flips its boolean. Meanwhile useReportRecipientLocalTime recreates canShowReportRecipientLocalTimeSelector(report, currentUserAccountID) as a brand-new closure on every render (no useMemo, no dependencies array passed to useOnyx):
Because the selector reference changes every render, the Onyx hook generates a fresh cacheKey and treats each render as a new consumer, but more importantly the boolean flip from false → true is decoupled from the recipient resolution. On the render where shouldShow finally becomes true, the second useOnyx's selector closure is also rebuilt with the new reportRecipientAccountID, and useSyncExternalStore schedules an additional snapshot read — but the early return if (!shouldShow || isEmptyObject(reportRecipient) || isAgentEmail(reportRecipient?.login)) runs before the second subscription has materialized the recipient from PERSONAL_DETAILS_LIST, so the component returns null and stays mounted as null. The Onyx callback for PERSONAL_DETAILS_LIST then never fires again (the underlying data did not change — only the local closure-captured accountID did), and useSyncExternalStore never re-evaluates, so the label is permanently hidden until the chat is remounted (e.g. by tapping into another chat and back). This matches what users see in 9.3.90-0: the row is simply missing for "any 1:1 chat" they open.
What changes do you think we should make in order to solve the problem?
Two coupled changes restore correctness while preserving the perf intent of PR #91416. First, remove the shouldShow gate on the recipient selector in ComposerLocalTime so that the recipient subscription is always alive once a reportRecipientAccountID exists — this guarantees that when useReportRecipientLocalTime flips to true, the recipient is already populated in the same render. Second, stabilise the selector inside useReportRecipientLocalTime with useMemo and pass [report, currentUserAccountID] as the third dependencies argument to useOnyx, which is the documented pattern Onyx uses to invalidate its snapshot cache when closure-captured values change (see useTransactionThread for a reference call site):
The key edit in ComposerLocalTime is dropping the shouldShow ? guard on the selector and letting personalDetailByAccountIDSelector itself handle the undefined account-ID case, while keeping the existing !shouldShow early return to suppress the row:
This is safe for ReportActionsListPaddingView (the other caller) because that wrapper only consumes the boolean for padding and is unaffected by recipient-resolution timing. It also preserves the perf goal of PR #91416 — ReportActionsList still avoids subscribing to the full PERSONAL_DETAILS_LIST collection — and brings ComposerLocalTime back in line with the pre-PR behavior where eligibility and recipient resolution were resolved against the same snapshot in a single render.
What alternative solutions did you explore? (Optional)
Reverting ComposerLocalTime to read usePersonalDetails() directly (the pre-PR pattern) would fix the bug with a smaller diff, but it re-introduces a full-collection subscription on the composer which would re-render on every unrelated profile update — exactly the regression PR #91416 was sent to fix. Stabilising the selector + ungating the recipient subscription keeps the perf win and is the minimal correctness patch.
Please re-state the problem that we are trying to solve in this issue.
In a 1:1 chat, the "It's {Time} for {Name}" label that should appear above the composer (showing the other user's local time) is never displayed. This happens on both standalone (web) and HybridApp, and reproduces in staging and production.
What is the root cause of that problem?
The label is rendered by ComposerLocalTime, which only renders ParticipantLocalTime when useReportRecipientLocalTime (i.e. canShowReportRecipientLocalTime) returns true:
The problem is that, when a 1:1 chat is opened, the recipient's entry in PERSONAL_DETAILS_LIST does not contain timezone or validated. Those richer fields are only fetched by the OpenPublicProfilePage command, which today is only triggered when you actually open someone's profile (ProfilePage calls it on mount):
Because the chat-open flow never loads the recipient's timezone/validated, reportRecipient?.validated ?? false evaluates to false, the gate returns false, and the label is hidden.
I confirmed this live in the dev app. In a real 1:1 DM the recipient's personal details were only {login, displayName, firstName} — no validated, no timezone — and the label was absent. The moment I merged {validated: true, timezone: {selected: 'Asia/Tashkent'}} into that recipient's personal details, the label rendered immediately ("It's 5:39 PM for Yusuf"). So the gate is the sole blocker, and the missing timezone/validated data is the cause.
Note: PR #91416 (linked in the report as the QA context) only refactored this path — it moved the same logic into useReportRecipientLocalTime + a useOnyx selector reading the same PERSONAL_DETAILS_LIST. It is behavior-preserving and is not the cause; the bug reproduces in production independently of it.
What changes do you think we should make in order to solve the problem?
Make the 1:1 chat-open flow fetch the recipient's full personal details, exactly the way ProfilePage already does, so the local-time gate has the timezone/validated it needs.
Concretely, when a report is a 1:1 chat, fetch the recipient's public profile for the single report recipient returned by getReportRecipientAccountIDs(report, currentUserAccountID):
Add a small effect that runs when the report is opened/changes — a natural home is alongside the existing report-open logic in ReportScreen (src/pages/inbox/ReportScreen.tsx), or in a dedicated hook used by the report footer. For a 1:1 chat with a single non-Expensify recipient whose personalDetails[recipientAccountID] is missing timezone/validated, call PersonalDetails.openPublicProfilePage(recipientAccountID) once.
This reuses the existing OPEN_PUBLIC_PROFILE_PAGE read command (same call ProfilePage makes), so once it resolves, canShowReportRecipientLocalTime returns true for validated recipients with a selected timezone and the label appears.
This does not regress other paths:
Group chats / rooms / policy-expense chats already return false from the gate (and getReportRecipientAccountIDs returns >1 or 0 recipients), so no fetch/label there.
Unvalidated recipients still resolve to validated !== true, so the label correctly stays hidden — matching the existing intentional behavior shared with ProfilePage.
Expensify/agent accounts are still excluded via isAgentEmail / EXPENSIFY_ACCOUNT_IDS.
What alternative solutions did you explore? (Optional)
Backend fix in OpenReport — have the server include timezone/validated for 1:1 participants in the OpenReport response, so no extra client request is needed. This is arguably the cleanest long-term fix, but it's a backend change and may be heavier than necessary for NewDot.
Fetch from the local-time component itself — trigger openPublicProfilePage from ComposerLocalTime/useReportRecipientLocalTime. Rejected because that component early-returns null while the gate is false (chicken-and-egg: it's false precisely because the data is missing), so the fetch must be driven independently of shouldShow, at the report level.
Relax the gate (drop the validated requirement) — rejected: the validated condition is intentional and is shared with ProfilePage's shouldShowLocalTime; showing local time for unvalidated accounts with an unreliable/default timezone would be wrong and inconsistent.
PR #91416 split a single inline computation into a two-stage subscription chain that subscribes to PERSONAL_DETAILS_LIST twice and chains the second subscription behind the first via the shouldShow ? ternary. That chaining is the bug — not the selectors per se.
Both subscriptions live in the same component tree:
On the first render after opening a 1:1 chat, report from useOnyx(REPORT_<id>) is briefly undefined (cache miss while the Onyx connection settles for that key). canShowReportRecipientLocalTime short-circuits to false because getReportRecipientAccountIDs(undefined, ...) returns [] and reportRecipient is therefore undefined inside the eligibility check: https://github.com/Expensify/App/blob/main/src/libs/ReportUtils.ts#L3182-L3196
That false is cached against the first-render selector reference in OnyxSnapshotCache. Step 2 sees shouldShow=false, so its selector is personalDetailByAccountIDSelector(undefined) — a function whose entire range is undefined. Onyx caches undefined for THAT selector reference too.
When report finally arrives on the next render, the new selector closure in step 1 closes over the populated report — but neither useOnyx call passes the closed-over values via the third dependencies argument, so OnyxSnapshotCache.invalidateForKey is never invoked. With the cache un-invalidated, step 1 keeps returning the stale false, which keeps step 2's selector permanently in its always-undefined branch. The early return if (!shouldShow || isEmptyObject(reportRecipient) || ...) fires and the row is permanently hidden until the chat is unmounted/remounted. The bug only reproduces in HybridApp / slower devices because that's where the multi-render hydration window is wide enough to seed the stale cache; the PR author's MacOS recording (Test 7 in the PR) never hit that window, which is why CI green-lit it.
The OLD code didn't have this failure mode because it pulled personalDetails from the sharedOnyxListItemProvider context — one stable subscription that re-rendered consumers on every change of the full list, with no per-selector cache layer between the data and the eligibility check.
What changes do you think we should make in order to solve the problem?
Collapse the two-stage chain into a single subscription that returns the eligible recipient (or undefined), and derive shouldShow synchronously from that recipient. This removes the cross-subscription cache race entirely and makes the hook return shape consistent with what the consumer actually needs to render.
Replace useReportRecipientLocalTime so it returns the recipient (already filtered by eligibility) instead of a bare boolean:
ReportActionsListPaddingView (the other caller) only needs a boolean for padding — adapt it to Boolean(useReportRecipientLocalTime({report})); the perf intent of PR #91416 is preserved because the selector still returns nothing (or one entry) instead of the full collection, so unrelated profile updates still don't re-render the list.
I'd also add a regression test that mounts ComposerLocalTime with report = undefined first and then merges the report after — the existing tests/unit/ComposerLocalTimeTest.tsx only covers the path where everything is in Onyx before render, which is precisely why this slipped through PR #91416's suite.
What alternative solutions did you explore? (Optional)
Keep the two-stage chain and just memoize selectors + pass dependencies to both useOnyx calls (the most popular framing in the existing proposals). This fixes the cache invalidation but leaves the chained-subscription design in place, which is the real fragility — anyone touching this code in the future would re-introduce the same trap as soon as they tweak the gate condition. The single-subscription rewrite is the same lines-of-code budget and removes the footgun.
Fetch the recipient's openPublicProfilePage on chat open so validated/timezone are present. That fixes a different failure mode (recipient genuinely missing those fields) but does not explain the QA report's "any 1:1 chat" phrasing, and would not fix the cache-race regression itself — once the recipient is hydrated, the stale false still wins until remount.
changed the title [-]Chat - "It´s {Time} for {Name}" label is not displayed above composer on 1:1 chat.[/-][+][$250] Chat - "It´s {Time} for {Name}" label is not displayed above composer on 1:1 chat.[/+]on Jun 1, 2026
⚠️@yusufdeveloper2903 Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
@VickyStash Yes, I can. I just opened a new chat with someone I hadn't chatted with before
Is it a person from another timezone? The label won't be shown if the user is in the same time zone.
@VickyStash I wonder why we only show that label for users in different time zones. The user doesn't know whether the person they're chatting with is in the same time zone or not.
Anyway, I noticed that we currently show the label even when the other user is in the same time zone:
The primary issues identified in the context revolve around two main areas:
Data Fetching and Availability for Local Time Display
The application fails to fetch essential personal details (like timezone and validation status) for 1:1 chat participants when a report is opened.
This results in the local time display feature not functioning as intended, even though it should be available for validated accounts with selected timezones.
Selector Caching and Dependency Management
The useOnyx hook selectors used in components like ComposerLocalTime and useReportRecipientLocalTime do not include dependencies.
This leads to stale data being served from the cache, causing the local time display feature to fail even when the necessary data is available.
Root Cause Analysis
Data Fetching Root Cause
The current implementation does not trigger a fetch for personal details of 1:1 chat participants upon report opening.
This contrasts with how ProfilePage handles this, making it inconsistent and leading to missing data in the local time display feature.
Selector Caching Root Cause
The absence of dependencies in useOnyx selectors causes them to rely solely on their initial state or cached values.
When external variables like report, currentUserAccountID, shouldShow, and reportRecipientAccountID change, the selectors do not re-evaluate, leading to stale data being used.
Proposed Solutions
Data Fetching Solution
Implement a mechanism in ReportScreen or a dedicated hook to fetch personal details for 1:1 chat participants when a report is opened.
This should be done conditionally only for 1:1 chats with non-Expensify recipients who lack the necessary timezone and validation data.
Selector Caching Solution
Update useOnyx selectors to include dependencies that reflect the external values they close over.
Specifically, add [report, currentUserAccountID] as dependencies in useReportRecipientLocalTime and [shouldShow, reportRecipientAccountID] in ComposerLocalTime.
This ensures that the selectors re-evaluate when their dependencies change, preventing stale data from being used.
Implementation Strategy
Data Fetching Implementation
Locate the appropriate place to trigger the fetch (e.g., within `
I have already identified the root cause of this issue and have a verified fix and Pull Request ready to submit. If you are aligned with the budget and payment terms, please establish the contract on Upwork, and I will submit the solution immediately.
@JS00001 backend must provide the missing recipient timezone reliably, and FE should avoid showing default/wrong local time when it is absent. updated my proposal for same
Looking at the BE, this looks intentional. We send a limited set of personal details for users who the user has no history with. I dont think this is worth fixing so I'm going to close this issue
Activity
applause-bot commentedon Jun 1, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/114ab8b1b8b681defb3ed10644cf9a62b60bde9d73bd5063e049df6768e91284
MelvinBot commentedon Jun 1, 2026
Proposal
This is a regression introduced by #91416 ("refactor: remove personalDetails from ReportActionsList dependencies"), the same PR this bug was caught QAing. That PR is the only recent change to this code, and a browser repro on current
mainconfirms the label still renders correctly for already-cached 1:1 DMs (Concierge, qa.guide) — so the steady-state logic is fine. The break is in how eligibility is recomputed while data hydrates.What is the root cause of that problem?
PR #91416 moved the recipient‑local‑time eligibility check out of an inline calculation over the full personal‑details list and into
useOnyxselectors that close over asynchronously‑loaded values:useReportRecipientLocalTime.ts:16subscribes toPERSONAL_DETAILS_LISTwith a selector that closes overreportandcurrentUserAccountID.ComposerLocalTime.tsx:22then fetches the recipient via a selector gated onshouldShow ? reportRecipientAccountID : undefined.Neither
useOnyxcall passes those closed‑over values in the thirddependenciesargument.useOnyx's snapshot cache only forces the selector to re‑run when (a) the subscribed key (PERSONAL_DETAILS_LIST) changes, (b) thedependenciesarray changes, or (c) the selector's function identity changes. Sincereport/currentUserAccountIDare neither the subscribed key nor declared dependencies, a correct recompute relies entirely on React Compiler emitting a new selector reference when those values change. Whenreport(orcurrentUserAccountID) hydrates across several renders — common on slower devices — the eligibility result gets cached asfalseand can stay stale, so the label never appears. TheshouldShow ?gate then chains the recipient lookup behind that stuck flag, compounding it.Evidence & mechanism detail
canShowReportRecipientLocalTime(personalDetails, report, accountID)inline on every render from the live full list, so it always reflected the currentreport— no cache contract to get stale.ReportUtils.ts:3182-3196(requires exactly one recipient, not a room/expense chat, recipient present,timezone.selected, andvalidated).react-native-onyxuseOnyx(OnyxSnapshotCachekeys results by selector identity;getSnapshotearly‑returns the cached result unless the source value, thedependencies, or the selector identity changed). Passingdependenciesexplicitly invalidates that cache — which is the pattern other selector call sites in the repo already follow viauseMemo+ a dependency list.main: label shows for Concierge ("It's 3:38 PM for Expensify") and qa.guide, and is correctly absent for a user with no selected timezone — confirming steady state works and the failure is load‑order/device‑timing specific (reported platform: Android hybrid).useReportRecipientLocalTime.test.ts] covers "personal details load after mount with a stable report", but nothing covers "report(orcurrentUserAccountID) hydrates after mount" — the exact ordering that regresses.What changes do you think we should make in order to solve the problem?
Make the selector dependency contract explicit instead of relying on the compiler:
useReportRecipientLocalTime, build the selector withuseMemokeyed on[report, currentUserAccountID]and pass[report, currentUserAccountID]as the thirduseOnyxdependenciesargument.ComposerLocalTime, do the same for the recipient selector (key it on the recipient account ID and pass that asdependencies), and drop theshouldShow ?gate at line 22 — the existingisEmptyObject(reportRecipient)guard already handles missing data, so gating the fetch on the eligibility flag is unnecessary and brittle.What alternative solutions did you explore? (Optional)
Revert
ComposerLocalTime/useReportRecipientLocalTimeto the previous inline computation overusePersonalDetails(). Simplest and definitely correct, but it reintroduces the full‑list subscription that #91416 removed for performance, so the targeteddependenciesfix above is preferred.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/92225)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
This appears to be a regression from #91416 — the team may prefer to route it back to that PR's author rather than the contributor flow.
MobileMage commentedon Jun 1, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-06-01 12:51:25 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Opening any 1:1 chat no longer shows the "It's {Time} for {Name}" row above the composer. The row is expected for validated DMs whose recipient has a selected timezone, and it was rendering correctly before the refactor in PR #91416 landed in 9.3.90-0.
What is the root cause of that problem?
PR #91416 (commit
fbdeb0d27a2) replaced the inlineusePersonalDetails()read inComposerLocalTimewith two independentuseOnyx(PERSONAL_DETAILS_LIST, {selector: ...})subscriptions — one wrapped in a newuseReportRecipientLocalTimehook that returns a boolean, and one local subscription that resolves the recipient object. Before the change, both the eligibility check and the recipient lookup ran inline against the samepersonalDetailsreference, so they were always consistent within a single render:App/src/pages/inbox/report/ReportActionCompose/ComposerLocalTime.tsx
Lines 14 to 26 in cae92c2
After the refactor, the second
useOnyxis gated onshouldShowbefore it will ever return the recipient:The selector is built with
personalDetailByAccountIDSelector(undefined)(which always returnsundefined) on every render whereshouldShowis false, and only switches topersonalDetailByAccountIDSelector(reportRecipientAccountID)onceuseReportRecipientLocalTimeflips its boolean. MeanwhileuseReportRecipientLocalTimerecreatescanShowReportRecipientLocalTimeSelector(report, currentUserAccountID)as a brand-new closure on every render (nouseMemo, nodependenciesarray passed touseOnyx):App/src/hooks/useReportRecipientLocalTime.ts
Lines 13 to 19 in cae92c2
Because the selector reference changes every render, the Onyx hook generates a fresh
cacheKeyand treats each render as a new consumer, but more importantly the boolean flip fromfalse → trueis decoupled from the recipient resolution. On the render whereshouldShowfinally becomestrue, the seconduseOnyx's selector closure is also rebuilt with the newreportRecipientAccountID, anduseSyncExternalStoreschedules an additional snapshot read — but the early returnif (!shouldShow || isEmptyObject(reportRecipient) || isAgentEmail(reportRecipient?.login))runs before the second subscription has materialized the recipient fromPERSONAL_DETAILS_LIST, so the component returnsnulland stays mounted asnull. The Onyx callback forPERSONAL_DETAILS_LISTthen never fires again (the underlying data did not change — only the local closure-capturedaccountIDdid), anduseSyncExternalStorenever re-evaluates, so the label is permanently hidden until the chat is remounted (e.g. by tapping into another chat and back). This matches what users see in 9.3.90-0: the row is simply missing for "any 1:1 chat" they open.What changes do you think we should make in order to solve the problem?
Two coupled changes restore correctness while preserving the perf intent of PR #91416. First, remove the
shouldShowgate on the recipient selector inComposerLocalTimeso that the recipient subscription is always alive once areportRecipientAccountIDexists — this guarantees that whenuseReportRecipientLocalTimeflips totrue, the recipient is already populated in the same render. Second, stabilise the selector insideuseReportRecipientLocalTimewithuseMemoand pass[report, currentUserAccountID]as the thirddependenciesargument touseOnyx, which is the documented pattern Onyx uses to invalidate its snapshot cache when closure-captured values change (seeuseTransactionThreadfor a reference call site):App/src/hooks/useTransactionThread.ts
Lines 51 to 57 in cae92c2
The key edit in
ComposerLocalTimeis dropping theshouldShow ?guard on the selector and lettingpersonalDetailByAccountIDSelectoritself handle the undefined account-ID case, while keeping the existing!shouldShowearly return to suppress the row:And in
useReportRecipientLocalTime, memoise the selector and forward dependencies so Onyx re-evaluates against the freshest closure:This is safe for
ReportActionsListPaddingView(the other caller) because that wrapper only consumes the boolean for padding and is unaffected by recipient-resolution timing. It also preserves the perf goal of PR #91416 —ReportActionsListstill avoids subscribing to the fullPERSONAL_DETAILS_LISTcollection — and bringsComposerLocalTimeback in line with the pre-PR behavior where eligibility and recipient resolution were resolved against the same snapshot in a single render.What alternative solutions did you explore? (Optional)
Reverting
ComposerLocalTimeto readusePersonalDetails()directly (the pre-PR pattern) would fix the bug with a smaller diff, but it re-introduces a full-collection subscription on the composer which would re-render on every unrelated profile update — exactly the regression PR #91416 was sent to fix. Stabilising the selector + ungating the recipient subscription keeps the perf win and is the minimal correctness patch.yusufdeveloper2903 commentedon Jun 1, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
In a 1:1 chat, the "It's {Time} for {Name}" label that should appear above the composer (showing the other user's local time) is never displayed. This happens on both standalone (web) and HybridApp, and reproduces in staging and production.
What is the root cause of that problem?
The label is rendered by
ComposerLocalTime, which only rendersParticipantLocalTimewhenuseReportRecipientLocalTime(i.e.canShowReportRecipientLocalTime) returnstrue:App/src/pages/inbox/report/ReportActionCompose/ComposerLocalTime.tsx
Lines 19 to 26 in cae92c2
canShowReportRecipientLocalTimerequires the recipient's personal details to contain bothvalidated === trueand atimezone.selected:App/src/libs/ReportUtils.ts
Lines 3182 to 3196 in cae92c2
The problem is that, when a 1:1 chat is opened, the recipient's entry in
PERSONAL_DETAILS_LISTdoes not containtimezoneorvalidated. Those richer fields are only fetched by theOpenPublicProfilePagecommand, which today is only triggered when you actually open someone's profile (ProfilePagecalls it on mount):App/src/libs/actions/PersonalDetails.ts
Lines 351 to 391 in cae92c2
App/src/pages/ProfilePage.tsx
Lines 128 to 134 in cae92c2
Because the chat-open flow never loads the recipient's
timezone/validated,reportRecipient?.validated ?? falseevaluates tofalse, the gate returnsfalse, and the label is hidden.I confirmed this live in the dev app. In a real 1:1 DM the recipient's personal details were only
{login, displayName, firstName}— novalidated, notimezone— and the label was absent. The moment I merged{validated: true, timezone: {selected: 'Asia/Tashkent'}}into that recipient's personal details, the label rendered immediately ("It's 5:39 PM for Yusuf"). So the gate is the sole blocker, and the missingtimezone/validateddata is the cause.Note: PR #91416 (linked in the report as the QA context) only refactored this path — it moved the same logic into
useReportRecipientLocalTime+ auseOnyxselector reading the samePERSONAL_DETAILS_LIST. It is behavior-preserving and is not the cause; the bug reproduces in production independently of it.What changes do you think we should make in order to solve the problem?
Make the 1:1 chat-open flow fetch the recipient's full personal details, exactly the way
ProfilePagealready does, so the local-time gate has thetimezone/validatedit needs.Concretely, when a report is a 1:1 chat, fetch the recipient's public profile for the single report recipient returned by
getReportRecipientAccountIDs(report, currentUserAccountID):ReportScreen(src/pages/inbox/ReportScreen.tsx), or in a dedicated hook used by the report footer. For a 1:1 chat with a single non-Expensify recipient whosepersonalDetails[recipientAccountID]is missingtimezone/validated, callPersonalDetails.openPublicProfilePage(recipientAccountID)once.This reuses the existing
OPEN_PUBLIC_PROFILE_PAGEread command (same callProfilePagemakes), so once it resolves,canShowReportRecipientLocalTimereturnstruefor validated recipients with a selected timezone and the label appears.This does not regress other paths:
falsefrom the gate (andgetReportRecipientAccountIDsreturns>1or0recipients), so no fetch/label there.validated !== true, so the label correctly stays hidden — matching the existing intentional behavior shared withProfilePage.isAgentEmail/EXPENSIFY_ACCOUNT_IDS.What alternative solutions did you explore? (Optional)
OpenReport— have the server includetimezone/validatedfor 1:1 participants in theOpenReportresponse, so no extra client request is needed. This is arguably the cleanest long-term fix, but it's a backend change and may be heavier than necessary for NewDot.openPublicProfilePagefromComposerLocalTime/useReportRecipientLocalTime. Rejected because that component early-returnsnullwhile the gate isfalse(chicken-and-egg: it'sfalseprecisely because the data is missing), so the fetch must be driven independently ofshouldShow, at the report level.validatedrequirement) — rejected: thevalidatedcondition is intentional and is shared withProfilePage'sshouldShowLocalTime; showing local time for unvalidated accounts with an unreliable/default timezone would be wrong and inconsistent.David-2002065 commentedon Jun 1, 2026
Proposal
What is the root cause of that problem?
PR #91416 split a single inline computation into a two-stage subscription chain that subscribes to
PERSONAL_DETAILS_LISTtwice and chains the second subscription behind the first via theshouldShow ?ternary. That chaining is the bug — not the selectors per se.Both subscriptions live in the same component tree:
useReportRecipientLocalTime→useOnyx(PERSONAL_DETAILS_LIST, {selector: canShowReportRecipientLocalTimeSelector(report, currentUserAccountID)})returns only the booleancanShow:https://github.com/Expensify/App/blob/main/src/hooks/useReportRecipientLocalTime.ts#L13-L19
ComposerLocalTimethen re-subscribes toPERSONAL_DETAILS_LISTto materialize the recipient object, but the selector argument is gated by the boolean from step 1:https://github.com/Expensify/App/blob/main/src/pages/inbox/report/ReportActionCompose/ComposerLocalTime.tsx#L19-L26
On the first render after opening a 1:1 chat,
reportfromuseOnyx(REPORT_<id>)is brieflyundefined(cache miss while the Onyx connection settles for that key).canShowReportRecipientLocalTimeshort-circuits tofalsebecausegetReportRecipientAccountIDs(undefined, ...)returns[]andreportRecipientis therefore undefined inside the eligibility check:https://github.com/Expensify/App/blob/main/src/libs/ReportUtils.ts#L3182-L3196
That
falseis cached against the first-render selector reference inOnyxSnapshotCache. Step 2 seesshouldShow=false, so its selector ispersonalDetailByAccountIDSelector(undefined)— a function whose entire range isundefined. Onyx cachesundefinedfor THAT selector reference too.When
reportfinally arrives on the next render, the new selector closure in step 1 closes over the populated report — but neitheruseOnyxcall passes the closed-over values via the thirddependenciesargument, soOnyxSnapshotCache.invalidateForKeyis never invoked. With the cache un-invalidated, step 1 keeps returning the stalefalse, which keeps step 2's selector permanently in its always-undefined branch. The early returnif (!shouldShow || isEmptyObject(reportRecipient) || ...)fires and the row is permanently hidden until the chat is unmounted/remounted. The bug only reproduces in HybridApp / slower devices because that's where the multi-render hydration window is wide enough to seed the stale cache; the PR author's MacOS recording (Test 7 in the PR) never hit that window, which is why CI green-lit it.The OLD code didn't have this failure mode because it pulled
personalDetailsfrom the sharedOnyxListItemProvidercontext — one stable subscription that re-rendered consumers on every change of the full list, with no per-selector cache layer between the data and the eligibility check.What changes do you think we should make in order to solve the problem?
Collapse the two-stage chain into a single subscription that returns the eligible recipient (or undefined), and derive
shouldShowsynchronously from that recipient. This removes the cross-subscription cache race entirely and makes the hook return shape consistent with what the consumer actually needs to render.Replace
useReportRecipientLocalTimeso it returns the recipient (already filtered by eligibility) instead of a bare boolean:Then in
ComposerLocalTime, drop the seconduseOnyxentirely and let one subscription carry both the eligibility and the recipient:ReportActionsListPaddingView(the other caller) only needs a boolean for padding — adapt it toBoolean(useReportRecipientLocalTime({report})); the perf intent of PR #91416 is preserved because the selector still returns nothing (or one entry) instead of the full collection, so unrelated profile updates still don't re-render the list.I'd also add a regression test that mounts
ComposerLocalTimewithreport = undefinedfirst and then merges the report after — the existingtests/unit/ComposerLocalTimeTest.tsxonly covers the path where everything is in Onyx before render, which is precisely why this slipped through PR #91416's suite.What alternative solutions did you explore? (Optional)
Keep the two-stage chain and just memoize selectors + pass
dependenciesto bothuseOnyxcalls (the most popular framing in the existing proposals). This fixes the cache invalidation but leaves the chained-subscription design in place, which is the real fragility — anyone touching this code in the future would re-introduce the same trap as soon as they tweak the gate condition. The single-subscription rewrite is the same lines-of-code budget and removes the footgun.Revert
ComposerLocalTimetousePersonalDetails()context. Smallest correctness diff but re-introduces the full-collection subscription PR refactor: remove personalDetails from ReportActionsList dependencies #91416 explicitly removed. Rejected to preserve the perf win for the composer path.Fetch the recipient's
openPublicProfilePageon chat open sovalidated/timezoneare present. That fixes a different failure mode (recipient genuinely missing those fields) but does not explain the QA report's "any 1:1 chat" phrasing, and would not fix the cache-race regression itself — once the recipient is hydrated, the stalefalsestill wins until remount.melvin-bot commentedon Jun 1, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @dmkt9 (
External)[-]Chat - "It´s {Time} for {Name}" label is not displayed above composer on 1:1 chat.[/-][+][$250] Chat - "It´s {Time} for {Name}" label is not displayed above composer on 1:1 chat.[/+]melvin-bot commentedon Jun 1, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022061430250839542644
github-actions commentedon Jun 1, 2026
18 remaining items
dmkt9 commentedon Jun 2, 2026
@VickyStash I wonder why we only show that label for users in different time zones. The user doesn't know whether the person they're chatting with is in the same time zone or not.
Anyway, I noticed that we currently show the label even when the other user is in the same time zone:
heroking777 commentedon Jun 2, 2026
Strategic Response to the Problem Context
Understanding the Core Issues
The primary issues identified in the context revolve around two main areas:
Data Fetching and Availability for Local Time Display
Selector Caching and Dependency Management
useOnyxhook selectors used in components likeComposerLocalTimeanduseReportRecipientLocalTimedo not include dependencies.Root Cause Analysis
Data Fetching Root Cause
ProfilePagehandles this, making it inconsistent and leading to missing data in the local time display feature.Selector Caching Root Cause
useOnyxselectors causes them to rely solely on their initial state or cached values.report,currentUserAccountID,shouldShow, andreportRecipientAccountIDchange, the selectors do not re-evaluate, leading to stale data being used.Proposed Solutions
Data Fetching Solution
ReportScreenor a dedicated hook to fetch personal details for 1:1 chat participants when a report is opened.Selector Caching Solution
useOnyxselectors to include dependencies that reflect the external values they close over.[report, currentUserAccountID]as dependencies inuseReportRecipientLocalTimeand[shouldShow, reportRecipientAccountID]inComposerLocalTime.Implementation Strategy
I have already identified the root cause of this issue and have a verified fix and Pull Request ready to submit. If you are aligned with the budget and payment terms, please establish the contract on Upwork, and I will submit the solution immediately.
dmkt9 commentedon Jun 4, 2026
This looks like a backend issue, since the
openReportAPI doesn't return thevalidatedandtimezonefields for the recipient:🎀 👀 🎀 C+ reviewed
melvin-bot commentedon Jun 4, 2026
Triggered auto assignment to @JS00001, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
JS00001 commentedon Jun 4, 2026
I see the label on production 🤔
Also, are we sure this is a BE issue? How would this feature have worked before if it was a BE issue?
KJ21-ENG commentedon Jun 4, 2026
@JS00001 backend must provide the missing recipient timezone reliably, and FE should avoid showing default/wrong local time when it is absent. updated my proposal for same
dmkt9 commentedon Jun 4, 2026
@JS00001 I think it was ignored because this issue can only be reproduced with an account that hasn’t been chatted with before.
For example, you can open a chat with my test account:
dmkt9x+test26068@gmail.comKJ21-ENG commentedon Jun 4, 2026
I agree with this, as I was also able to reproduce the issue only with accounts where I haven't opened any chats yet.
JS00001 commentedon Jun 8, 2026
Looking at this today
JS00001 commentedon Jun 8, 2026
Looking at the BE, this looks intentional. We send a limited set of personal details for users who the user has no history with. I dont think this is worth fixing so I'm going to close this issue