Repository navigation
Conversation
|
sorry for the ping, I messed up assignment |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppios.mp4iOS: mWeb SafariMacOS: Chrome / Safaritest.mov |
situchan
left a comment
There was a problem hiding this comment.
Looks good.
Left NAB comments in tests files
| await waitForBatchedUpdatesWithAct(); | ||
|
|
||
| // Then no confirmation opens, because the report is no longer empty | ||
| expect(mockOpenCreateReportConfirmation).not.toHaveBeenCalled(); |
There was a problem hiding this comment.
The new "does not open" test only checks that something didn't happen
It asserts that the confirmation wasn't opened, so it would still pass if tapping "Create report" did nothing at all.
createNewReport is already mocked, so the test should also assert that it was called, as the Search test does:
| const EMPTY_REPORT_ID = 'empty-report'; | ||
| const EMPTY_REPORT: Report = { | ||
| reportID: EMPTY_REPORT_ID, | ||
| policyID: MOCK_POLICY_ID, | ||
| ownerAccountID: CURRENT_USER_ACCOUNT_ID, | ||
| type: CONST.REPORT.TYPE.EXPENSE, | ||
| stateNum: CONST.REPORT.STATE_NUM.OPEN, | ||
| statusNum: CONST.REPORT.STATUS_NUM.OPEN, | ||
| total: 0, | ||
| nonReimbursableTotal: 0, | ||
| }; |
There was a problem hiding this comment.
**The new EMPTY_REPORT constant is only used in one
Only the new test uses EMPTY_REPORT_ID / EMPTY_REPORT
The two existing tests in the same file still inline the same object with a hardcoded 'empty-report':
Either use the constant in those tests too or remove it.
|
|
||
| // And an empty open expense report owned by the user appears while the menu is closed | ||
| await act(async () => { | ||
| await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}empty-report`, { |
There was a problem hiding this comment.
The empty report is set up differently in the two test files
The Search test's copy (also at L399 and L438) leaves out total: 0 / nonReimbursableTotal: 0, but the
AttachmentPicker copy includes them.
Both count as empty today.
Two different definitions could drift apart, though, if hasEmptyReportsForPolicy starts checking totals.
| }; | ||
|
|
||
| function renderComponent() { | ||
| function renderPicker(isMenuVisible: boolean) { |
There was a problem hiding this comment.
renderPicker doesn't render anything
This returns the element and renderComponent calls render.
A name like getPickerElement would make the rerender(renderPicker(true)) calls easier to read.
|
|
||
| expect(mockOpenCreateReportConfirmation).not.toHaveBeenCalled(); | ||
| }); | ||
| it('opens confirmation modal when an empty report appears while the menu is closed', async () => { |
There was a problem hiding this comment.
Missing blank line between 2 tests
|
@TMisiukiewicz feel free to address the relevant NABs in a follow up 🙇 |
|
🚧 rlinoz 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/rlinoz in version: 9.5.5-0 🚀
|
|
No help site update needed. This PR only delays the empty-report check until the |
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.5.5-2 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
Opening a report was slow on accounts with many expenses. Before a user creates a new report, the app checks whether they already have an empty one, so it can ask "are you sure?". To answer that, it went through every expense the user has. It did this again on every expense update, even while the "Create report" option was hidden. On an account with about 52,000 expenses that took about 80ms each time. Several screens each ran their own copy of the check, many times while a report loads.
The answer is only needed when the user can actually press "Create report", and that option lives inside a menu. This PR skips the check while the menu is closed and runs it as soon as the menu opens:
+menu.The check itself is unchanged, so the confirmation shows up in exactly the same cases as before. Opening a report in a dev build with 4x CPU slowdown went from about 3982ms to about 3491ms on average, roughly 12% faster.
Fixed Issues
$ #103343
PROPOSAL:
Tests
+button in the composer and choose "Create report".+> "Create report" again.Offline tests
Same as tests, but with the network connection turned off. Verify the app behaves the same and no errors appear.
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, 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.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
🤖 Generated with Claude Code