Skip to content

Fix To-Dos badge flicker by gating inbox counts on reportAttributes#93593

Closed
MelvinBot wants to merge 1 commit into
mainfrom
claude-inboxCountReportAttributesFlicker
Closed

Fix To-Dos badge flicker by gating inbox counts on reportAttributes#93593
MelvinBot wants to merge 1 commit into
mainfrom
claude-inboxCountReportAttributesFlicker

Conversation

@MelvinBot

Copy link
Copy Markdown
Contributor

Explanation of Change

The "To-Dos" Inbox tab badge briefly drops by one and bounces back after deleting an expense when an empty report still requires attention.

The badge count comes from SidebarUtils.getInboxTabCounts, which reads each report's requiresAttention flag. That flag is sourced from the reportAttributes derived value, but the count's useMemo in useSidebarOrderedReports depended on orderedReportIDs/reportsToDisplayInLHN, both of which react to raw REPORT writes. Those raw writes land one paint before the reportAttributes derived value recomputes, so the count was momentarily built from a mix of the new raw report data and the stale (not-yet-recomputed) requiresAttention — producing a wrong transient count, then settling back once reportAttributes caught up.

This implements the approved alternative: gate the count recompute on the reportAttributes derived value instead of on raw REPORT writes. reportAttributes lists REPORT/REPORT_METADATA/REPORT_ACTIONS (and NETWORK) as dependencies, so it still recomputes on every write that can change To-do or Unread state — just at the settled point, after reportsToDisplayInLHN has incorporated the raw write. priorityMode and betas remain in the dependency array so non-REPORT rebuild triggers (focus-mode switch, beta load) — which don't race with reportAttributes — still update the badge. The badge now transitions directly from the old value to the correct value, with no intermediate state.

Fixed Issues

$ #93521
PROPOSAL: #93521 (comment)

Tests

// TODO: The human co-author must fill out the tests you ran before marking this PR as "ready for review".
// Please describe what tests you performed that validate your change worked.

  1. Open any workspace chat that has at least one workspace.
  2. Create a manual expense and an empty report.
  3. Navigate to the "To-Dos" filter on "Inbox".
  4. Select the expense and delete it.
  5. Verify the "To-Dos" counter does not flicker (briefly decrease then increase) when an empty report is still present.
  • Verify that no errors appear in the JS console

Offline tests

Same as Tests.

QA Steps

// TODO: The human co-author must fill out the QA tests you ran before marking this PR as "ready for review".

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).

…icker

Co-authored-by: Youssef Lourayad <youssef-lr@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

🚧 @youssef-lr has triggered a test Expensify/App build. You can view the workflow run here.

@youssef-lr youssef-lr closed this Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants