Skip to content

Studio: mount the API monitor inside a host that stays mounted, so opening it in Glass stops restyling the app - #17418

Merged
danielhanchen merged 1 commit into
mainfrom
studio-api-monitor-stable-host
Nov 10, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
studio-api-monitor-stable-host

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

With Reduce motion on (the default since #17377), opening or closing the floating API monitor in any Glass material restyled the whole app root. That is the area-matrix failure on main and on every PR, in Frontend build + bundle sanity, Composer (ubuntu-latest, browsers) and Inline images (ubuntu-latest):

appearance mode liquid makes area api_monitor cost 3,626 elements restyled against 112 in the default appearance at 40 turns = 32.4x (limit 10.0x ...)
appearance mode liquid-3d makes area api_monitor cost 4,905 elements restyled against 110 in the default appearance at 200 turns = 44.6x (limit 10.0x ...)

This fixes it without touching Reduce motion, Glass, or how the panel looks or behaves.

Cause

__root.tsx renders <ApiMonitorOverlay /> before the sidebar, and the overlay returned its AnimatePresence directly. Each open therefore inserted the panel's fixed wrapper as the first child of #root, and each close removed it again.

A Chrome trace with invalidation tracking shows that insertion invalidating the whole #root subtree (Chromium's positional sibling invalidation). Under Reduce motion in Glass that is about 1,700 elements on open and 1,650 on close. The position is what matters. In the same page state:

Inserted node Elements restyled
a plain <div> prepended to #root 1,653
a plain <div> appended to #root 5
a plain <div> appended to <body> 4

Change

ApiMonitorOverlay now returns an always-mounted host, <div data-api-monitor-host="" className="contents">, with the AnimatePresence inside it. The panel mounts and unmounts inside that host, so #root's children never change when it opens.

  • display: contents keeps the host out of layout. The panel is position: fixed with its own z-index, so where it sits and what it covers are unchanged.
  • The overlay stays in the same place in the React tree, so the useId paths of everything after it are unchanged.

tests/api-monitor-stable-host.test.ts pins this: the overlay returns the host, the host is not conditional and is contents, and AnimatePresence sits inside it. On main's overlay the test fails.

Measured

Production long-thread build, Chromium, the area matrix's own Page.sweep, elements restyled by the api_monitor area:

Appearance Turns main this PR
default 40 110 108
liquid 40 4,105 382
blurred 40 3,849 385
frosted 40 3,853 388
liquid-3d 40 4,141 131
liquid-3d 200 4,905 290

All of these are now well inside the 10x ceiling (at most 3.6x), and CPU stays inside it too (liquid 7.1x, liquid-3d 5.9x at 200 turns).

Testing

  • tests/api-monitor-stable-host.test.ts passes, and fails on main's overlay.
  • The existing overlay suites pass, 302 tests: api-monitor-snapshot, drag-costs-no-render, floating-panel-position, glass-motion, find-in-page, keyboard-shortcuts.
  • tsc --noEmit is clean.

Nothing on screen changes: the panel opens in the same place with the same fade, so there are no before and after screenshots.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 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-10T15:36:11.766762Z 3158c78 Manual request
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 3158c786b9

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 817a00c into main Nov 10, 2026
@danielhanchen
danielhanchen deleted the studio-api-monitor-stable-host branch November 10, 2026 15:39
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.

1 participant