Repository navigation
perf: fix expensive Concierge and Desk Lottie assets and remove unused animations - #108055
Conversation
|
|
|
@nkdengineer 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] |
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. |
|
Can we see some before/after videos? Thanks! |
|
@shawnborton I added them to the PR description |
|
@wcandillon The concierge lottie doesn't animate on this branch
Screen.Recording.2026-11-26.at.17.08.07.mov
Screen.Recording.2026-11-26.at.17.08.33.mov |
|
I thought had a Concierge thinking animation that was like this infinite scaling effect... Right now you are showing ScanGradient and ScanOuterGlow - I thought we decided to only use ScanGradient and not use ScanOuterGlow for the actual thinking indicator? |
|
@shawnborton On ScanOuterGlow: since #96286 the indicator picks one of four variants at random on each mount (ScanGradient, ScanOuterGlow, InceptionTriangle, Hypnotized), and this PR doesn't change that list. |
|
@nkdengineer |
|
After installing the node-modules again, it works now. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-11-27.at.00.09.31.movAndroid: mWeb ChromeScreen.Recording.2026-11-27.at.00.07.01.moviOS: HybridAppScreen.Recording.2026-11-27.at.00.08.48.moviOS: mWeb SafariScreen.Recording.2026-11-27.at.00.10.31.movMacOS: Chrome / SafariScreen.Recording.2026-11-27.at.00.05.47.movScreen.Recording.2026-11-27.at.00.06.30.mov |
Ah okay, I actually think it might have been a mistake to add both of those scan variations - I think ultimately we were just deciding between which one to use. That being said, we can keep them both as-is but consider removing one in a separate PR. cc @Expensify/design for visibility. |
mountiny
left a comment
There was a problem hiding this comment.
Thanks. Sounds like we can move this ahead. If we want to remove some of the animations, we can do it in a separate PR.
|
🚧 mountiny 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/mountiny in version: 9.5.55-0 🚀
|
|
Not emergency, the action was broken on main and fixed by this pr #108084 |
|
No help site update needed — this PR optimizes existing animations and removes unused assets without adding features, changing user workflows, or making existing article instructions incorrect. |
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.5.55-6 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
Three of the Concierge "thinking" avatars and the Desk animation are expensive to play because of how they were exported, whichever player renders them (lottie-react-native, dotLottie or Skottie). This PR rewrites the JSON of those files with a script and commits the output. The player, the components and their props are unchanged.
ConciergeThinkingScanGradient,ConciergeThinkingScanOuterGlow,ConciergeThinkingHypnotized): each file had 31 alpha mattes, and 26 to 28 of them were the same full-size circle, whichConciergeAnimatedAvataralready clips its container to. The copies date from feat(concierge): show animated thinking avatar while Concierge responds #96286, which repacked the files so that iOS and Android render them: the export had one circle shared by its layers throughtp, and the repack gave each layer its own copy. Those mattes are removed and the eye-shaped ones stay, each still directly above the layer it applies to. lottie-android renders an animation in software on the UI thread when it has more than four mattes or masks, so ScanGradient (4) and ScanOuterGlow (3) are back on the GPU. Hypnotized keeps 5 mattes and 1 mask, so it stays in software, with less to draw. The fourth avatar, InceptionTriangle, is not touched: only one of its 7 mattes is the circle, so it would stay in software either way."hd": false, which makes Skottie draw them as visible shapes while every other player hides them. The key is removed. The file was also exported at 69 fps (689 frames). Every time is converted to 24 fps, at the same speed. 689 frames at 69 fps is 239.65 frames at 24 fps, and the composition now ends on frame 239: rounded up to 240, it would outlast its layers and players would draw nothing for the last 14 ms of each loop. The loop is 27 ms shorter than before (9.958 s instead of 9.986 s). This saves nothing on native, where Desk plays today, because lottie-ios and lottie-android redraw at the display rate. It is for players that redraw on each frame of the animation, like dotLottie on web.Planeentry ofLottieAnimations(340 KB less in the repo).npm run fix-lottie-assets(scripts/fixLottieAssets.ts) applies these rewrites toassets/animationsin place. A file that is already fixed is left untouched, so the script can be run again when Design exports one of these files again.-- --checkonly reports. A test intests/tooling/fixLottieAssets.test.tsfails when a committed file needs the fix, andassets/animations/**is added to the paths of the Bun tests workflow so that a PR that only changes an animation runs it.ConciergeAnimatedAvatargets a comment: the animations now rely on the circular clip of its container..lottiefile is a zip archive.scripts/utils/ZipUtils.tsreads and writes it withnode:zlib(deflate level 9, fixed dates), so the same input always gives the same file and no dependency is added.Coin (About page) cannot be fixed by a script. Whether to author it again is a separate question for Design, tracked in the issue.
ConciergeThinkingScanGradient.lottieConciergeThinkingScanOuterGlow.lottieConciergeThinkingHypnotized.lottieDesk.lottieMeasurements. These come from the proposal. The script output is identical to the measured files for the three avatars. For Desk it differs in one value, the out point of the composition (239 here, 240 in the measured file, see above), and by less than 3e-14 of a frame on 172 time values. Android is a Galaxy S25 Edge, release build, avatar at its real 40 dp. Web is Chrome at 1x and 24 fps.
What I checked on this branch.
ConciergeAnimatedAvatar, paused on the same six frames onmainand on this branch, for the three files. SSIM is 0.997 or higher on every frame. The only pixels that differ are on the edge of the circle, where the matte and the container no longer anti-alias the same edge twice. See the screenshot below.mainand on this branch, at the start, at 5 s and on the last two frames of the loop: the matte shapes are gone and the picture is complete until the end of the loop. See the second screenshot below.java.util.zip.ZipInputStream(what lottie-android reads.lottiefiles with), byunzip -tand by Python'szipfile. I also read the zip reader that lottie-ios embeds: it accepts these archives (file entries, CRC checked).Fixed Issues
$ #108014
PROPOSAL: https://expensify.slack.com/archives/C08CZDJFJ77/p1795621393236469
Tests
npm run fix-lottie-assets -- --check. Verify that it lists the four files as already fixed and exits with 0.TZ=utc npx bun test --parallel --preload ./scripts/stubReactNative.js --preload ./tests/tooling/setup.ts ./tests/tooling/fixLottieAssets.test.ts ./tests/tooling/ZipUtils.test.ts. Verify that the 15 tests pass.Offline tests
No offline behavior changes. The assets are bundled with the app, and the thinking avatar is not shown while offline.
QA Steps
Same as tests 3 to 6.
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
concierge-avatars-main-vs-pr.mp4
desk-main-vs-pr.mp4