Skip to content

revert: rebuild the menu bar on native AppKit menus (#2057) - #2071

Merged
datlechin merged 1 commit into
mainfrom
revert/main-menu-appkit
Aug 10, 2026
Merged

revert: rebuild the menu bar on native AppKit menus (#2057)#2071
datlechin merged 1 commit into
mainfrom
revert/main-menu-appkit

Conversation

@datlechin

Copy link
Copy Markdown
Member

Restores the menu bar. #2057 shipped a rewrite that SwiftUI silently undoes at launch.

What happens

Measured on the running app with OSLog probes:

install (applicationDidFinishLaunching): [App|File|Edit|View|Database|Query|Window|Help]
next run loop turn:                      [App|File|Edit|View|Database|Query|Window|Help]
+0.5s:                                   [App|View|Window|Help]

SwiftUI reconciles NSApp.mainMenu once, shortly after launch, and discards the AppKit menu. File, Edit, Database and Query disappear.

Why it cannot be patched

Under the SwiftUI App lifecycle the real NSApp.delegate is a private SwiftUI.AppDelegate that forwards only some selectors, and SwiftUI reconciles into the existing NSMenu using its own NSMenuItem subclass, removing plain NSMenuItems. The menu pointer never changes, so pointer-identity KVO stays silent.

Every hook was measured on the real app and none work: KVO on NSApp.mainMenu, didUpdateNotification, didBecomeKeyNotification, and the applicationDidUpdate(_:) delegate method never fire. applicationDidBecomeActive fires before the reconciliation. Only a wall-clock delay works, which is not something to ship.

Scope

Reverts only #2057. Every other merged PR is untouched: TableProApp.swift is byte-identical to its state at #2067, and the three PRs merged after #2057 (#2068, #2069, #2070) are unaffected.

Disconnect and Reconnect return to the Connection menu as #2056 shipped them.

Next

The menu architecture itself was right; responder-chain validation is the only mechanism that serves both a SwiftUI scene and an AppKit window. The foundation was wrong. Owning the main menu requires the AppKit app lifecycle, which this app is already 90% of the way to. That migration is planned separately, and Core/Menu/** returns unchanged as part of it.

@mintlify

mintlify Bot commented Aug 10, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
TablePro 🟡 Building Aug 10, 2026, 7:56 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@datlechin
datlechin merged commit dbb084f into main Aug 10, 2026
4 checks passed
@datlechin
datlechin deleted the revert/main-menu-appkit branch August 10, 2026 07:57
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