Repository navigation
perf(mobile): cut 173 KB from the phone page so its size fence has headroom again - #46183
Conversation
…adroom again - Ship 256 px bot mascot renders for mobile instead of desktop's 512 px set (-138 KB of images). Mobile draws them at most 88 pt, the same resolution as their rims. - Build the page's Mermaid engine for Safari 15 only; the page that imports it is already es2022, so the Chrome 74 lowering only added bytes (-35 KB). Gated page bytes 11,271,825 -> 11,098,686 of 11,272,192. The fence is unchanged.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
ELI5
The phone's web page hit its size limit, so every new mobile change failed CI. This PR makes the page 173 KB smaller without changing anything people see, and leaves the limit where it is.
What Changed
Gated bytes as
verify-mobile-web-app-bundle.mjscounts them (all page bytes except the approved terminal fonts and the language catalogs). The budget is 11,272,192 and stays unchanged:a60d999mobile/assets/bot-mascots/. Desktop's files and the rims are untouched.chrome74, safari15. The page that imports it already ships es2022, so Chrome 74 could not run that page anyway, and the lowering only added bytes. The target is nowsafari15. The terminal WebView engines keepchrome74.What grew since the last fence change (#44465, which measures 11,023,326 once merged): +248 KB, about 200 KB of it bot features. That breaks down as native-chat bot cards (Google setup, Composio) +62 KB, shared bot code +56 KB,
mobile/src/bots+95 KB (webhooks, tools, items), and hand-to-bot workspace actions +12 KB. No npm package grew.Fence design note: the fence counts total page bytes, not first-load bytes, so lazy-loading screens cannot help it. Only shipping fewer bytes moves it. First open has its own 3 MiB entry fence, and this PR leaves the entry unchanged at 1,526,464 bytes.
Follow-ups, deliberately left out: dedupe
@react-native/normalize-colors, the page's only duplicate package version (~7.5 KB). Trimming Mermaid diagram types (up to ~1 MB) would be a product call. This is mechanical bundle work, so no comparable product applies.Why
This unblocks main. PR #46160 was 1,587 bytes over after merging main. Raising the fence again was ruled out, and these two cuts are the largest that change no screen.
Linked Issue
None. Maintainer fix for the mobile web bundle budget on main.
Visual Proof
Mockup, not a product screenshot: a standalone page that draws only the repo's mascot image files at 88 pt, the way
MobileBotAvatarlayers them, rendered in headless Playwright WebKit atdeviceScaleFactor: 3. It contains no app UI and no real data. Each mascot appears on a light tile and on a dark tile with the rim. Top row: the old 512 px set. Bottom row: the new 256 px set.Testing
pnpm run build:mobile-web(build + verify): main 11,271,825 → branch 11,098,686 gated bytes. The buildId is reproducible, and route, chunk and asset counts are unchanged (18 / 88 / 215).mobile-web-app-mermaid-render.test.mjs, which renders a Mermaid diagram plus the broken-source fallback through the regenerated engine, andmobile-web-app-bots-render.test.mjs, which draws bot rows with their mascot assets from the built page. WebKit here is a desktop Playwright build, not an iOS 15 device.pnpm check:changed: 16 checks passed. CI carries the full suites.Performance
Fewer bytes only: −138 KB of mascot images and −35 KB of the deferred Mermaid chunk. No code path runs more often.
Review / platform
These are build-config and asset changes for the mobile page only; the native app also picks up the smaller mascots. Desktop, SSH and Windows are unaffected.
Risk
The riskiest part is the Mermaid engine target: a WebView older than Safari 15 or Chrome 80 would now fail to parse the Mermaid chunk. Such a WebView already fails on the es2022 page, so nothing that works today breaks. Mascots look slightly softer only above 85 pt at 3x, and no current screen draws them that large. Back out with a plain revert.