Repository navigation
Conversation
1 task
This branch has not been deployed
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
Every LHN row decides whether its action badge reads "Mark as done" instead of "Submit".
OptionRowLHNContentcallsshouldShowMarkAsDonebefore it checks whether the row shows the Submit badge.For users who chose to track expenses and use a Submit & Close workspace,
shouldShowMarkAsDonepasses its cheap checks for each of their own reports. It then callsgetNextApproverAccountID, which scans every approval rule and reads personal details. This runs on every render of every such row. Only draft reports show the Submit badge, so most of those results are thrown away.This PR checks the Submit badge first, so
shouldShowMarkAsDoneruns only for rows that show it. Both checks have no side effects, so the result stays the same.This is one of four PRs from a second scan for the pattern in Perf: check cheap conditions before expensive ones in report, option list, and bulk action paths.
Automated tests
tests/unit/OptionRowLHNContentTest.tsx. It asserts that a row with the Approve badge never callsshouldShowMarkAsDone, and that a row with the Submit badge still gets the "Mark as done" copy. The first test fails onmainand passes with this change.npx jest --runTestsByPath tests/unit/OptionRowLHNContentTest.tsx tests/unit/OptionRowLHNDataFocusTest.tsx tests/ui/components/LHNOptionsListTest.tsx(14 tests).npm run lint-changed,npm run spell-changed, andnpm run react-compiler-compliance-check check-changed.npm run typecheckreports no errors in the changed files.Fixed Issues
$ #108605
PROPOSAL:
Tests
Offline tests
Same as Tests. The reordered checks read only local data, so offline behavior does not change.
QA Steps
No QA. This PR only changes the order of checks that have no side effects, so nothing changes for the user. The automated tests above cover the change.
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
Not tested on this platform. This PR only reorders checks that have no side effects, and the unit tests above cover it.
Android: mWeb Chrome
Not tested on this platform. This PR only reorders checks that have no side effects, and the unit tests above cover it.
iOS: Native
Not tested on this platform. This PR only reorders checks that have no side effects, and the unit tests above cover it.
iOS: mWeb Safari
Not tested on this platform. This PR only reorders checks that have no side effects, and the unit tests above cover it.
MacOS: Chrome / Safari
Not tested on this platform. This PR only reorders checks that have no side effects, and the unit tests above cover it.