Skip to content

perf(mac): dropdowns open instantly unless text services need teardown - #461

Merged
SergeSerb2 merged 1 commit into
mainfrom
surgecode/popover-open-latency
Aug 3, 2026
Merged

perf(mac): dropdowns open instantly unless text services need teardown#461
SergeSerb2 merged 1 commit into
mainfrom
surgecode/popover-open-latency

Conversation

@SergeSerb2

Copy link
Copy Markdown
Owner

Problem

Every dropdown routed through .stablePopover (composer model picker, run-profile/runtime/interaction chips, context meter, git branch/actions chips, sidebar filter chips, "+New Session", right-click Alpine menus) waited an unconditional 250ms before presenting on macOS 27 — the StablePopoverPolicy.prepareForTransientWindow() fence added by fe75e8f5b against an NSInternalInconsistencyException in remote text-service teardown. Combined with SwiftUI popover materialization, dropdowns took 0.5–1s to appear.

Fix

The exception only fires when an editable view is tearing down a remote text-service child. prepareForTransientWindow() now tracks whether it actually detached anything (an editable NSTextView first responder, or a text responder it had to resign) and skips the 250ms sleep entirely when there was none. Clicking a chip with the composer unfocused — the overwhelmingly common case — presents immediately; opening a dropdown while actively editing keeps the full fence.

No behavior change on macOS ≠ 27 (workaround already gated).

Verification

  • Default UIProbe sweep (model-picker popover stages included): passes with only the three pre-existing activity-dock mount-check failures that also fail on main.
  • pnpm run verify — pass. PopoverSearchFieldTests (version gate + delay constant) unaffected.

🤖 Generated with Claude Code

…y detach

The macOS 27 workaround slept 250ms before presenting every guarded popover,
putting a quarter-second floor under every dropdown in the app regardless of
whether the crash it guards against could occur. The exception fires when an
editable view is tearing down a remote text-service child; with no text view
focused there is nothing detaching, so present immediately and keep the fence
only for the case that needs it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@SergeSerb2 SergeSerb2 added the size:XS Tiny internal, documentation, or narrowly scoped fix label Aug 3, 2026
@SergeSerb2
SergeSerb2 merged commit 82d82bd into main Aug 3, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS Tiny internal, documentation, or narrowly scoped fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant