fix(macos): remove self-delegate on cost usage submenu to prevent recursive dropdown

The cost usage submenu set `menu.delegate = self` (the MenuSessionsInjector),
which caused `menuWillOpen(_:)` to call `inject(into:)` on the submenu when
it opened. This re-inserted the "Usage cost (30 days)" item into the submenu,
creating an infinite recursive dropdown.

Fix: remove the delegate assignment from the submenu — it does not need
the injector's delegate behavior since it only contains a static chart view.

Closes #25167

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
yingchunbai
2026-02-24 19:26:20 +08:00
committed by Peter Steinberger
parent 2bad30b4d3
commit 96b21f4823

View File

@@ -493,7 +493,6 @@ extension MenuSessionsInjector {
guard !summary.daily.isEmpty else { return nil }
let menu = NSMenu()
menu.delegate = self
let chartView = CostUsageHistoryMenuView(summary: summary, width: width)
let hosting = NSHostingView(rootView: AnyView(chartView))