Fix To-Dos badge flicker by gating inbox counts on reportAttributes#93593
Closed
MelvinBot wants to merge 1 commit into
Closed
Fix To-Dos badge flicker by gating inbox counts on reportAttributes#93593MelvinBot wants to merge 1 commit into
MelvinBot wants to merge 1 commit into
Conversation
…icker Co-authored-by: Youssef Lourayad <youssef-lr@users.noreply.github.com>
7 tasks
Contributor
|
🚧 @youssef-lr has triggered a test Expensify/App build. You can view the workflow run here. |
Contributor
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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'srequiresAttentionflag. That flag is sourced from thereportAttributesderived value, but the count'suseMemoinuseSidebarOrderedReportsdepended onorderedReportIDs/reportsToDisplayInLHN, both of which react to rawREPORTwrites. Those raw writes land one paint before thereportAttributesderived 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 oncereportAttributescaught up.This implements the approved alternative: gate the count recompute on the
reportAttributesderived value instead of on rawREPORTwrites.reportAttributeslistsREPORT/REPORT_METADATA/REPORT_ACTIONS(andNETWORK) as dependencies, so it still recomputes on every write that can change To-do or Unread state — just at the settled point, afterreportsToDisplayInLHNhas incorporated the raw write.priorityModeandbetasremain in the dependency array so non-REPORTrebuild triggers (focus-mode switch, beta load) — which don't race withreportAttributes— 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.
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".
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssection