Skip to content

perf: fix expensive Concierge and Desk Lottie assets and remove unused animations - #108055

Merged
mountiny merged 2 commits into
Expensify:mainfrom
wcandillon:perf/lottie-asset-fixes
Nov 26, 2026
Merged

mountiny merged 2 commits into
Expensify:mainfrom
wcandillon:perf/lottie-asset-fixes

Conversation

@wcandillon

@wcandillon wcandillon commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • Concierge avatars (ConciergeThinkingScanGradient, ConciergeThinkingScanOuterGlow, ConciergeThinkingHypnotized): each file had 31 alpha mattes, and 26 to 28 of them were the same full-size circle, which ConciergeAnimatedAvatar already 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 through tp, 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.
  • Desk (Troubleshoot page, native): its 8 matte layers had an explicit "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.
  • Plane and ExpensifyLounge have no consumer. Both files are deleted, with the Plane entry of LottieAnimations (340 KB less in the repo).
  • npm run fix-lottie-assets (scripts/fixLottieAssets.ts) applies these rewrites to assets/animations in 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. -- --check only reports. A test in tests/tooling/fixLottieAssets.test.ts fails when a committed file needs the fix, and assets/animations/** is added to the paths of the Bun tests workflow so that a PR that only changes an animation runs it.
  • ConciergeAnimatedAvatar gets a comment: the animations now rely on the circular clip of its container.
  • A .lottie file is a zip archive. scripts/utils/ZipUtils.ts reads and writes it with node: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.

File Layers Mattes Frames Size
ConciergeThinkingScanGradient.lottie 63 → 36 31 → 4 96 at 24 fps 4,220 → 4,009 B
ConciergeThinkingScanOuterGlow.lottie 63 → 35 31 → 3 96 at 24 fps 4,132 → 3,906 B
ConciergeThinkingHypnotized.lottie 63 → 37 31 → 5 96 at 24 fps 108,219 → 108,010 B
Desk.lottie unchanged 8, unchanged 689 at 69 fps → 239 at 24 fps 165,410 → 151,548 B

Measurements. 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.

Asset and player Before → after What is measured
Concierge, lottie-react-native on Android 38% → 15% of a core UI thread, the file drops under the software threshold of lottie-android
Concierge Hypnotized, lottie-react-native on Android 39% → 30% of a core UI thread, still rendered in software
Concierge, Skottie on react-native-skia 3 39% → 25% of a core Total CPU
Concierge, dotLottie on web 8% → 3% of a core Main thread
Desk at 24 fps, dotLottie on web 19% → 10% of a core No change for a player that redraws on every display frame
Desk matte layers, Skottie SSIM 0.96 → 0.996 Agreement with the other players

What I checked on this branch.

  • Web (dev App, Chrome, dotLottie): the avatar view of ConciergeAnimatedAvatar, paused on the same six frames on main and 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.
  • Desk rendered with Skottie (CanvasKit 0.41.1) on main and 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.
  • The four rewritten archives are read by dotLottie on web (in the App), by java.util.zip.ZipInputStream (what lottie-android reads .lottie files with), by unzip -t and by Python's zipfile. I also read the zip reader that lottie-ios embeds: it accepts these archives (file entries, CRC checked).
  • Not checked in the App: Android native and iOS native, which is where Desk plays. The Android numbers above are from the bench app of the proposal, not from New Expensify.

Fixed Issues

$ #108014
PROPOSAL: https://expensify.slack.com/archives/C08CZDJFJ77/p1795621393236469

Tests

  1. Run npm run fix-lottie-assets -- --check. Verify that it lists the four files as already fixed and exits with 0.
  2. Run 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.
  3. Ask Concierge a question somewhere it shows its thinking indicator, for example in the Concierge side panel or in a #admins room.
  4. Verify that the Concierge avatar animates while Concierge is thinking, inside its circle, with nothing drawn outside of it. One of four animations is picked at random each time, so repeat a few times.
  5. Android and iOS only: go to Account > Troubleshoot.
  6. Verify that the Desk animation at the top of the page plays as before: same motion, same speed, a loop of 10 seconds, and no flash when it starts over.
  • Verify that no errors appear in the JS console

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.

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari concierge-web-main-vs-pr desk-skottie-main-vs-pr
concierge-avatars-main-vs-pr.mp4
desk-main-vs-pr.mp4

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ This PR is possibly changing native code and/or updating libraries, it may cause problems with HybridApp. Please check if any patch updates are required in the HybridApp repo and run an AdHoc build to verify that HybridApp will not break. Ask Contributor Plus for help if you are not sure how to handle this. ⚠️

@wcandillon
wcandillon marked this pull request as ready for review November 26, 2026 08:03
@wcandillon
wcandillon requested review from a team as code owners November 26, 2026 08:03
@expensify-chore-bot
expensify-chore-bot Bot requested review from nkdengineer and removed request for a team November 26, 2026 08:03
@expensify-chore-bot

Copy link
Copy Markdown

@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]

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T08:22:05.770666Z 93f04ee Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@expensify-chore-bot
expensify-chore-bot Bot requested review from garrettmknight and removed request for a team November 26, 2026 08:03
@shawnborton

Copy link
Copy Markdown
Contributor

Can we see some before/after videos? Thanks!

@wcandillon

Copy link
Copy Markdown
Contributor Author

@shawnborton I added them to the PR description

@nkdengineer

Copy link
Copy Markdown
Contributor

@wcandillon The concierge lottie doesn't animate on this branch

  • Here is the result on stanging
Screen.Recording.2026-11-26.at.17.08.07.mov
  • Here is in the current branch
Screen.Recording.2026-11-26.at.17.08.33.mov

@shawnborton

Copy link
Copy Markdown
Contributor

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?

@wcandillon

Copy link
Copy Markdown
Contributor Author

@shawnborton
The infinite zoom one is ConciergeThinkingInceptionTriangle. It is still there and unchanged; the video only shows the three files this PR rewrites, and that one didn't need a fix.

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.

@wcandillon

Copy link
Copy Markdown
Contributor Author

@nkdengineer
Thanks for testing. I can't reproduce this: on a local web build of this branch, all four variants load and play, with the side panel open too. To narrow it down: which browser is this, is there an error in the console when the indicator shows, and does main built locally behave the same? The staging recording is a production build, so the two videos differ by more than the branch.

@nkdengineer

Copy link
Copy Markdown
Contributor

After installing the node-modules again, it works now.

@nkdengineer

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Screen.Recording.2026-11-27.at.00.09.31.mov
Android: mWeb Chrome
Screen.Recording.2026-11-27.at.00.07.01.mov
iOS: HybridApp
Screen.Recording.2026-11-27.at.00.08.48.mov
iOS: mWeb Safari
Screen.Recording.2026-11-27.at.00.10.31.mov
MacOS: Chrome / Safari
Screen.Recording.2026-11-27.at.00.05.47.mov
Screen.Recording.2026-11-27.at.00.06.30.mov

@nkdengineer nkdengineer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@melvin-bot
melvin-bot Bot requested a review from mountiny November 26, 2026 17:13
@shawnborton

Copy link
Copy Markdown
Contributor

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.

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 mountiny left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
mountiny merged commit 9e9eab0 into Expensify:main Nov 26, 2026
60 of 75 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@melvin-bot melvin-bot Bot added the Emergency label Nov 26, 2026
@melvin-bot

melvin-bot Bot commented Nov 26, 2026

Copy link
Copy Markdown

@mountiny looks like this was merged without a test passing. These checks had not passed on 93f04ee when it was merged:

Please add a note explaining why this was done and remove the Emergency label if this is not an emergency.

@github-actions

Copy link
Copy Markdown
Contributor

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/mountiny in version: 9.5.55-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@mountiny

Copy link
Copy Markdown
Contributor

Not emergency, the action was broken on main and fixed by this pr #108084

@MelvinBot

Copy link
Copy Markdown
Contributor

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.


view run

@OSBotify

OSBotify commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/mountiny in version: 9.5.55-6 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants