Repository navigation
Conversation
Contributor
Contributor
Author
|
Closing in favor of #106100 |
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
#104522 removed manual memoization from compiled code. Every changed file still compiled, so the React Compiler compliance check passed, but many components and hooks lost their caching and ran heavy work on every render. This PR adds a third rule to
react-compiler-compliance-check check-changedthat catches this.How it works: for every modified .ts/.tsx file that exists on main (new files, tests and files the compiler skips are left out), the check compiles the main version and the branch version with the same React Compiler config the build uses. In each compiled function it counts every call as guarded, meaning it sits inside an
ifthat reads the compiler cache$[...], or unguarded, meaning it runs on every render. Calls inside callbacks, hook calls and compiler helpers are ignored. JSX elements count as<Name>, and compiler temporaries are normalized so renumbering does not cause noise. A call is reported when its guarded count drops and its unguarded count rises, so a new uncached call next to cached ones is not reported. A function that cached something on main and is no longer compiled on the branch is reported as "no longer compiled". The failure names the function and the callee that now runs on every render.contributingGuides/REACT_COMPILER.mddescribes the rule and how to fix a failure.Validation: run on the #104522 merge, the check flags 93 of the 919 modified files in about 19 seconds, including every file we later had to fix (
useReportActionsPagination,useReportPreviewSenderID,TransactionPreviewContent,MoneyRequestReceiptView,SearchAutocompleteList,SearchSelectionFooterand others). So #104522 would have failed this check.Costs:
.github/workflows/react-compiler-compliance.ymlalready runscheck-changedon every PR that touches .ts/.tsx files, and rule 3 runs inside that step.TransactionListItemInnerand [Rules Engine Release 2] [App] Support expense defaults for more than just merchants #104155 inuseTaxAmount) are worth fixing. The other three ([Insights polish] Update pie chart labels styling and total value formatting #105747, [CP Staging] fix: restore Connections tab param scoping and the accounting help link #105735, [Payment due @FitseTLT] [NoQA] Remove the globalReimbursementFX beta #105659) lose caching on cheap calls, so about 2% of PRs would be blocked for little gain.Known gaps:
useColumnResizestopped compiling, is not flagged.Fixed Issues
$ #106004
PROPOSAL:
Tests
useReportActionsPaginationchange from [Perf] Restore React Compiler caching in useReportActionsPagination #105781, then commit it.npm run react-compiler-compliance-check check-changed.useReportActionsPaginationwith the calls that now run on every render.Offline tests
N/A, this only changes a CI script.
QA Steps
None, this only changes a CI script.
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
iOS: mWeb Safari
MacOS: Chrome / Safari