Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Custom menu items don’t work after updating app menu #10121

Open
BjornDCode opened this issue Jun 25, 2024 · 0 comments
Open

[bug] Custom menu items don’t work after updating app menu #10121

BjornDCode opened this issue Jun 25, 2024 · 0 comments
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@BjornDCode
Copy link

Describe the bug

My app has a main window and a sub window that can be launched from the main window. In the main window I’ve created a menu and call menu.setAsAppMenu() to activate it. One of the menu items is a custom MenuItem to launch the sub window.

When I launch the sub window I want a different app menu. So I create a completely different menu and listen for tauri://window-created to activate it. I listen for ‘tauri://destroyed' on the sub window to reset the menu back to the original menu.

When I open the sub window the new menu is updated correctly. When I close the sub window the original menu is also updated correctly. Except none of the custom MenuItem’s in the original menu work anymore. They still show up and look clickable but nothing happens when they are clicked. PredefinedMenuItem’s work fine.

Reproduction

Reproduction: https://github.com/BjornDCode/tauri-app-menu-bug

  1. Run npm run tauri dev
  2. Click on 'File' -> 'New sub window'
  3. Check that it opens a new window
  4. Close the newly opened window
  5. Click on 'File' -> 'New sub window' again
  6. Verify that action doesn't work the 2nd time

Expected behavior

I would expect custom menu items to work after the menu is updated

Full tauri info output

[✔] Environment
    - OS: Mac OS 13.3.0 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.78.0 (9b00956e5 2024-04-29)
    ✔ cargo: 1.78.0 (54d8815d0 2024-03-26)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 20.7.0
    - pnpm: 8.14.2
    - yarn: 1.22.21
    - npm: 10.1.0

[-] Packages
    - tauri [RUST]: 2.0.0-beta.22
    - tauri-build [RUST]: 2.0.0-beta.17
    - wry [RUST]: 0.40.1
    - tao [RUST]: 0.28.1
    - @tauri-apps/api [NPM]: 2.0.0-beta.13
    - @tauri-apps/cli [NPM]: 2.0.0-beta.20

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: React
    - bundler: Vite

Stack trace

No response

Additional context

No response

@BjornDCode BjornDCode added status: needs triage This issue needs to triage, applied to new issues type: bug labels Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

1 participant