perf(mac): dropdowns open instantly unless text services need teardown - #461
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 — theStablePopoverPolicy.prepareForTransientWindow()fence added byfe75e8f5bagainst anNSInternalInconsistencyExceptionin 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 editableNSTextViewfirst 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
activity-dockmount-check failures that also fail onmain.pnpm run verify— pass.PopoverSearchFieldTests(version gate + delay constant) unaffected.🤖 Generated with Claude Code