[No QA] refactor: Extract LHNEmptyState from LHNOptionsList#86964
[No QA] refactor: Extract LHNEmptyState from LHNOptionsList#86964BartekObudzinski wants to merge 5 commits intoExpensify:mainfrom
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.
|
9b2f868 to
036b7d6
Compare
Parent (SidebarLinks) now guards LHNOptionsList rendering, so the component never mounts when data is empty. Removed unreachable hooks, useMemo, and conditional BlockingView render. Kept the "Woohoo" logging useEffect for observability.
Remove !isLoadingReportData guard from shouldShowEmptyLHN to match the original LHNOptionsList behavior where the empty state renders regardless of loading state. The skeleton overlay handles the loading UI separately. Fixes SidebarOrderTest failure.
Code ReviewThe extraction of 1. Dead logging
|
Looks like this is not related. Maybe copied form another PR? |
| if (data.length === 0) { | ||
| Log.info('Woohoo! All caught up. Was rendered', false, { | ||
| reportsCount: Object.keys(reports ?? {}).length, | ||
| policyCount: Object.keys(policy ?? {}).length, | ||
| personalDetailsCount: Object.keys(personalDetails ?? {}).length, | ||
| reportsIDsFromUseReportsCount: data.length, | ||
| }); |
There was a problem hiding this comment.
This log should be relocated
There was a problem hiding this comment.
Good catch. Moved the logging useEffect into LHNEmptyState where it actually fires on mount. Also removed the now-unused Log import from LHNOptionsList.
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. ℹ️ 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". |
You are right, those items were from a different branch. Removed items 4-6 from the PR description. Only changes 1-3 are in this diff. Also moved the dead logging |
|
I'm off on Monday since holiday in Poland |
| Log.info('Woohoo! All caught up. Was rendered', false, { | ||
| reportsCount: Object.keys(reports ?? {}).length, | ||
| policyCount: Object.keys(policy ?? {}).length, | ||
| personalDetailsCount: Object.keys(personalDetails ?? {}).length, |
There was a problem hiding this comment.
Should we log this only once on first time render? Now it's logged every time reports, policy or personalDetails is updated.
This was existing logic so not a blocker.
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppios.moviOS: mWeb Safarimsafari.movMacOS: Chrome / Safariweb.mov |
|
No product review needed |
Explanation of Change
LHNOptionsListpreviously owned the entire empty-inbox UI inline: three hooks (useTheme,useMemoizedLazyExpensifyIcons,useEmptyLHNIllustration), oneuseMemofor subtitle JSX construction, and a conditionalBlockingViewrender. These ran on every mount ofLHNOptionsList, including the 99%+ of renders wheredata.length > 0and the empty state is never shown.This PR:
LHNEmptyStatecomponent that only mounts when the inbox is actually emptySidebarLinks(parent level), soLHNOptionsListnever mounts with empty dataLHNOptionsList: 3 hook calls,emptyLHNSubtitleuseMemo (12 deps), conditionalBlockingViewrender, and 7 unused imports. The "Woohoo! All caught up" logging useEffect has been relocated toLHNEmptyStatewhere it actually fires.ManualNavigateToInboxTab span benchmark (10 runs each, iOS Simulator, same session):
Delta: -53ms (-7.8%). Perf-neutral to marginally better.
Validated against Onyx rules, React Compiler rules, React Native best practices, and Expensify coding standards. UI is identical between main and branch (verified via accessibility tree diff and visual screenshot comparison).
Fixed Issues
$ #87080
PROPOSAL:
Tests
Offline tests
N/A
QA Steps
Same as tests
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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari