[CP Stg] Fix memoized icon crashes - #96164
Conversation
PR #96115 caused useMemoizedLazyExpensifyIcons to cache rendered <svg /> elements instead of component references, breaking ImageSVG. Co-authored-by: Cursor <cursoragent@cursor.com>
typeof === 'function' rejected React.memo icon components in tests. Reject only rendered React elements, not valid component types. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@sobitneupane 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] |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
🚧 roryabraham has triggered a test Expensify/App build. You can view the workflow run here. |
…rash [CP Stg] Fix memoized icon crashes (cherry picked from commit 70cb35f) (cherry-picked to staging by roryabraham)
|
✋ 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! 🧪🧪
|
|
🚀 Cherry-picked to staging by https://github.com/roryabraham in version: 9.4.34-9 🚀
|
|
🤖 No help site changes required. This PR is an internal bug fix for icon rendering. It only modifies There is no user-facing behavior change — no new or modified feature, setting, tab, label, button, or workflow — so nothing in Expensify's help site articles ( @roryabraham, if you believe a specific article is affected that I missed, let me know the article and I'll create the docs PR. |
|
🚀 Cherry-picked to staging by https://github.com/roryabraham in version: 9.4.34-10 🚀
|
|
Deploy Blocker #96207 was identified to be related to this PR. |
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.4.34-14 🚀
|
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.4.34-14 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Cherry-picked to staging by https://github.com/roryabraham in version: 9.4.35-1 🚀
|
No help site changes requiredThis PR is a purely internal engineering fix and has no impact on any user-facing behavior documented on the help site. What it changes: It fixes crashes introduced by #96115 where the OXC React Compiler was memoizing pre-rendered Why no docs update: The change is confined to icon-loading internals. There is no new feature, no UI/label/setting change, and no change to product behavior that any article under No draft PR was created since none is warranted. |
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.4.35-6 🚀
|
Explanation of Change
Fixes several crashes introduced by #96115. OXC React Compiler was memoizing pre-rendered
<svg />elements inuseMemoizedLazyExpensifyIconsinstead of component references, which brokeImageSVG. This PR ensures icon hooks always return function components and removes the finaluseMemothat triggered incorrect fusion.Fixed Issues
$ #96158
$ #96159
$ #96161
Tests
Retest all three linked issues.
Offline tests
N/A
QA Steps
Retest all three linked issues.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand 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
web.mov
web.mov