Skip to content

Commit

Permalink
fix(core): menu remove js binding not working (#9219)
Browse files Browse the repository at this point in the history
* Fix menu `remove` js binding not working

* add change file [skip ci]

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
  • Loading branch information
Legend-Master and lucasfernog authored Mar 19, 2024
1 parent fb14633 commit 43230cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-menu-remove-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri": patch:bug
---

Fixes the menu plugin `remove` command signature.
10 changes: 5 additions & 5 deletions core/tauri/src/menu/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,19 +536,19 @@ fn insert<R: Runtime>(
#[command(root = "crate")]
fn remove<R: Runtime>(
app: AppHandle<R>,
menu_rid: ResourceId,
menu_kind: ItemKind,
rid: ResourceId,
kind: ItemKind,
item: (ResourceId, ItemKind),
) -> crate::Result<()> {
let resources_table = app.resources_table();
let (rid, kind) = item;
match menu_kind {
match kind {
ItemKind::Menu => {
let menu = resources_table.get::<Menu<R>>(menu_rid)?;
let menu = resources_table.get::<Menu<R>>(rid)?;
do_menu_item!(resources_table, rid, kind, |i| menu.remove(&*i))?;
}
ItemKind::Submenu => {
let submenu = resources_table.get::<Submenu<R>>(menu_rid)?;
let submenu = resources_table.get::<Submenu<R>>(rid)?;
do_menu_item!(resources_table, rid, kind, |i| submenu.remove(&*i))?;
}
_ => return Err(anyhow::anyhow!("unexpected menu item kind").into()),
Expand Down

0 comments on commit 43230cb

Please sign in to comment.