Skip to content

Toggle the inspector without animation to avoid a hang on macOS 27 - #27

Merged
phalladar merged 2 commits into
phalladar:mainfrom
horus-leonardo:fix/inspector-collapse-hang
Nov 25, 2026
Merged

phalladar merged 2 commits into
phalladar:mainfrom
horus-leonardo:fix/inspector-collapse-hang

Conversation

@horus-leonardo

Copy link
Copy Markdown
Contributor

Problem

On macOS 27, clicking the Inspector button after a scan hangs the app at 100% CPU. Sometimes it recovers after several seconds. Other times AppKit throws from -[NSWindow _postWindowNeedsUpdateConstraints] while collapsing the split view item, and the app aborts.

Cause

Animating the .inspector loops AppKit's constraint pass when the treemap view has a .contextMenu. Any context menu triggers it, even a static one with a single button. Without the context menu, or without the animation, it doesn't happen.

  • A minimal app with NavigationSplitView, .inspector and the same toolbar button doesn't hang.
  • Hiding the sidebar, which is also animated, doesn't hang.
  • It reproduces on main and back to 1c963ec (Nov 5), on both a local SDK 15 build and one stamped as SDK 26. So it looks like a change in macOS 27 rather than in a recent commit.

Fix

Toggle showInspector without animation. The inspector now appears and disappears without sliding.

I didn't try to keep the animation. That would likely mean replacing the treemap's SwiftUI .contextMenu with an AppKit NSMenu, a much bigger PR, and I didn't want to drop a large review on you for a cosmetic gain. Still, it would be worth digging deeper, either to restore the animation or to find out whether a later macOS 27 update fixes it.

Validation

  • An automated repro scans a folder, clicks the Inspector button and samples the process. On main it hangs at about 99% CPU, with _setCollapsed:animated: in the stack. On this branch it stays at 0% after three clicks, on a local SDK 15 build and on one stamped as SDK 26.
  • swift build, swift test.
  • Tested on macOS 27.2.1.

🤖 Generated with Claude Code

Animating the inspector while the treemap has a .contextMenu loops
AppKit's constraint pass until it throws.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@phalladar
phalladar merged commit 4e41701 into phalladar:main Nov 25, 2026
1 check passed
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.

2 participants