Skip to content

fix: menu regression from #15679 - #15735

Merged
lucasfernog merged 2 commits into
devfrom
fix/menu-regression
Jul 16, 2026
Merged

fix: menu regression from #15679#15735
lucasfernog merged 2 commits into
devfrom
fix/menu-regression

Conversation

@lucasfernog

Copy link
Copy Markdown
Member

No description provided.

@lucasfernog
lucasfernog requested a review from a team as a code owner July 16, 2026 13:42
FabianLars
FabianLars previously approved these changes Jul 16, 2026
Legend-Master
Legend-Master previously approved these changes Jul 16, 2026

@Legend-Master Legend-Master left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just knew for a fact calling something in drop would break something 😂

@Legend-Master Legend-Master left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should move the menu creation after app.register_core_plugins()?; like we did for initializing tray icons? (we should probably still keep the try_state to keep it safe though)

tauri/crates/tauri/src/app.rs

Lines 2383 to 2396 in e9e88a7

#[cfg(desktop)]
if let Some(menu) = self.menu {
let menu = menu(&app.handle)?;
app
.manager
.menu
.menus_stash_lock()
.insert(menu.id().clone(), menu.clone());
#[cfg(target_os = "macos")]
init_app_menu(&menu)?;
app.manager.menu.menu_lock().replace(menu);
}

Comment thread crates/tauri/src/menu/plugin.rs Outdated
pub(crate) fn remove_menu_channel<R: Runtime>(app: &AppHandle<R>, id: &MenuId) {
app.state::<MenuChannels>().0.lock().unwrap().remove(id);
// The state is only managed once this plugin is initialized, which happens after
// the `Builder::menu` closure runs, so menus dropped before that have no channel to remove.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// the `Builder::menu` closure runs, so menus dropped before that have no channel to remove.
// the `crate::Builder::menu` closure runs, so menus dropped before that have no channel to remove.

@lucasfernog
lucasfernog dismissed stale reviews from Legend-Master and FabianLars via eb46b16 July 16, 2026 13:50
@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Package Changes Through eb46b16

There are 14 changes which include tauri with minor, tauri-cli with minor, @tauri-apps/cli with minor, tauri-bundler with minor, tauri-utils with minor, tauri-build with minor, tauri-macos-sign with minor, tauri-runtime-wry with minor, tauri-runtime with minor, tauri-codegen with minor, tauri-macros with minor, tauri-plugin with minor, tauri-driver with minor, @tauri-apps/api with minor

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
@tauri-apps/api 2.11.1 2.12.0
tauri-utils 2.9.3 2.10.0
tauri-macos-sign 2.3.4 2.4.0
tauri-bundler 2.9.4 2.10.0
tauri-runtime 2.11.3 2.12.0
tauri-runtime-wry 2.11.4 2.12.0
tauri-codegen 2.6.3 2.7.0
tauri-macros 2.6.3 2.7.0
tauri-plugin 2.6.3 2.7.0
tauri-build 2.6.3 2.7.0
tauri 2.11.5 2.12.0
@tauri-apps/cli 2.11.4 2.12.0
tauri-cli 2.11.4 2.12.0
tauri-driver 2.0.6 2.1.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@lucasfernog
lucasfernog merged commit f064da2 into dev Jul 16, 2026
26 checks passed
@lucasfernog
lucasfernog deleted the fix/menu-regression branch July 16, 2026 15:22
@sftse

sftse commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

I wonder if we should move the menu creation after app.register_core_plugins()?; like we did for initializing tray icons? (we should probably still keep the try_state to keep it safe though)

tauri/crates/tauri/src/app.rs

Lines 2383 to 2396 in e9e88a7

#[cfg(desktop)]
if let Some(menu) = self.menu {
let menu = menu(&app.handle)?;
app
.manager
.menu
.menus_stash_lock()
.insert(menu.id().clone(), menu.clone());
#[cfg(target_os = "macos")]
init_app_menu(&menu)?;
app.manager.menu.menu_lock().replace(menu);
}

This is probably not the right conversation to unpack this, but I think the state management should be strictly split between user and Tauri state. State initialization order is a bit non-obvious, and could be made more type safe.

@Legend-Master

Copy link
Copy Markdown
Contributor

I do think there's room for improvement, but not sure how, do you have some ideas (no rush though)?

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.

4 participants