Repository navigation
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.
|
|
@aimane-chnaif Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
@MelvinBot test |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
🤖 Web test steps verification results: Dev NewDot web coverage was blocked by the available fixture and automation limitations. Native gestures and performance were not tested; failed checks below indicate incomplete verification, not confirmed product defects.
|
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppios.mp4iOS: mWeb SafariMacOS: Chrome / Safariweb.mov |
dylanexpensify
left a comment
There was a problem hiding this comment.
Product input not required for this PR.
| const isScreenFocusedRef = useRef(isScreenFocused); | ||
| const hideProductTrainingTooltipRef = useRef(hideProductTrainingTooltip); | ||
|
|
||
| useEffect(() => { | ||
| isScreenFocusedRef.current = isScreenFocused; | ||
| hideProductTrainingTooltipRef.current = hideProductTrainingTooltip; | ||
| }); |
There was a problem hiding this comment.
Reuse useIsFocusedRef instead of syncing a focus ref by hand
The outer provider passes useIsFocused() down as a prop and the inner one copies it into a ref in an effect after every render. useIsFocusedRef already does this and updates on the blur and focus events themselves.
It would remove the isScreenFocused prop and stop the inner provider from re-rendering (with useReportAttributes and the tooltip hook) on every RHP open.
const isScreenFocusedRef = useIsFocusedRef() in the inner provider and drop the prop.
There was a problem hiding this comment.
I tried useIsFocusedRef, but it doesn't stop the inner provider from re-rendering on blur. It calls useLHNRowProductTrainingTooltip, which reads the visibility context, and that changes on every RHP open. That's fine because the row value and actions stay the same, so rows don't re-render. It would also mean adding isFocused to the navigation mocks in 4 LHN test suites, so I kept the prop.
| /** | ||
| * Provides the contexts every row reads. Their values must not change when the LHN screen loses focus (for example when an RHP opens), | ||
| * so focus and the tooltip hide action are exposed as getters backed by refs. | ||
| */ | ||
| function LHNTooltipRowContextProvider({data, isScreenFocused, children}: LHNTooltipRowContextProviderProps) { |
There was a problem hiding this comment.
Explain why there are two providers
LHNTooltipRowContextProvider has to sit under LHNTooltipVisibilityContext.Provider because useLHNRowProductTrainingTooltip reads that context. Nothing says so. If the two get merged, the hook reads the default (isScreenFocused: false) and hide on press silently does nothing on narrow layout.
Add one line to the JSDoc about this ordering.
There was a problem hiding this comment.
Added a note to the JSDoc.
| /** Functions every row calls on press. The value never changes, so reading it never re-renders a row. */ | ||
| type LHNTooltipActionsContextValue = { | ||
| /** Hides the Concierge product training tooltip */ | ||
| hideConciergeTooltip: () => void; | ||
|
|
||
| /** Reads the LHN screen focus at the time of the call */ | ||
| getIsScreenFocused: () => boolean; | ||
| }; |
There was a problem hiding this comment.
NAB: one name for the hide action
The same function is hideProductTrainingTooltip in the hook and ref but hideConciergeTooltip in the context. The hook's TODO says the tooltip won't stay Concierge-specific.
Use hideProductTrainingTooltip in the context too.
There was a problem hiding this comment.
Renamed to hideProductTrainingTooltip.
| const mockHideProductTrainingTooltip = jest.fn(); | ||
| jest.mock('@components/LHNOptionsList/OptionRowLHN/useLHNRowProductTrainingTooltip', () => ({ | ||
| __esModule: true, | ||
| default: () => ({hideProductTrainingTooltip: mockHideProductTrainingTooltip}), | ||
| })); |
There was a problem hiding this comment.
The test mocks away the part most likely to break
The mocked useLHNRowProductTrainingTooltip ignores context, so the stable hide test still passes if the provider nesting from point 2 is wrong.
Have the mock read useLHNTooltipVisibilityContext() and assert it sees the current focus, or spy on the shouldShow passed to useProductTrainingContext.
There was a problem hiding this comment.
The mock now reads the visibility context, and a new test checks that it sees the current focus. It fails if the providers are nested the other way.
|
Please merge main. The branch is behind 1.1k commits |
|
@aimane-chnaif done |
|
🚧 Julesssss has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/Julesssss in version: 9.5.41-0 🚀
|
|
No help site update needed — this PR only improves rendering performance without changing user-facing workflows, labels, feature availability, or existing article accuracy. |
|
🚀 Deployed to production by https://github.com/marcaaron in version: 9.5.41-2 🚀
Bundle Size Analysis (Sentry): |

Explanation of Change
LHNTooltipContextProviderputuseIsFocused()and a root navigation flag in the same context value that every Inbox row reads. Opening an RHP, such as Create expense, takes focus away from the Inbox. The value changed, so every visible row re-rendered together with everything under it, even though the Inbox is hidden behind the RHP. On native the Inbox tab stays mounted under every RHP, so this cost grows with the number of reports.The context is now split in three:
LHNTooltipContextkeeps the onboarding data the rows show.LHNTooltipActionsContextholdshideConciergeTooltipandgetIsScreenFocused. They are backed by refs, so the value never changes and rows never re-render because of it.Pressableuses them on press and long press.LHNTooltipVisibilityContextholds the focus, navigation and fullscreen flags. Only the row that renders the Concierge tooltip reads it.The provider now calls
useLHNRowProductTrainingTooltiponce instead of once per row. The Concierge LHN tooltip is currently disabled (shouldShowreturns false inTOOLTIPS.ts), so its behavior can't change. The hide path is kept so it still works if the tooltip is turned back on.Performance, iOS simulator (iPhone 18 Pro, DEV build), heavy account, Create expense opened from the Inbox through the actions menu with Manual as the last tab, 6 interleaved blocks of 6 opens after warmup:
In the commit that mounts the page, the Inbox list goes from about 21ms of render time to 0.4ms.
Fixed Issues
$ #106767
PROPOSAL:
Tests
Offline tests
Same as tests while offline. The change only affects rendering, with no API calls.
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)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.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
Long press and tap on Inbox rows: VIDEO_TO_UPLOAD
iOS: mWeb Safari
MacOS: Chrome / Safari