mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-02-06 14:17:02 +00:00
fix(core): menu remove js binding not working (#9219)
* Fix menu `remove` js binding not working * add change file [skip ci] --------- Co-authored-by: Lucas Nogueira <lucas@tauri.app>
This commit is contained in:
parent
fb146339cc
commit
43230cb6b7
5
.changes/fix-menu-remove-api.md
Normal file
5
.changes/fix-menu-remove-api.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri": patch:bug
|
||||
---
|
||||
|
||||
Fixes the menu plugin `remove` command signature.
|
||||
@ -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()),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user