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] app unresponsive after some plugin API calls (tauri 2.0) #7673

Closed
dtanzer opened this issue Aug 22, 2023 · 6 comments
Closed

[bug] app unresponsive after some plugin API calls (tauri 2.0) #7673

dtanzer opened this issue Aug 22, 2023 · 6 comments
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@dtanzer
Copy link

dtanzer commented Aug 22, 2023

Describe the bug

I have a tauri-2.0 project project on Windows 11 that uses (amon others) the "dialog" and "window" plugins. With version 2.0.0-alpha.0 of those plugins and tauri 2.0.0-alpha.10, everything worked as expected.

After updating to

[build-dependencies]
tauri-build = { version = "2.0.0-alpha.8", features = [] }

[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "2.0.0-alpha.11", features = [] }
tauri-plugin-window = "2.0.0-alpha.1"
tauri-plugin-dialog = "2.0.0-alpha.1"

the app (browser and dev-tools) becomes completely unresponsive after some API-calls.

Reproduction

  • Check out dtanzer/tauri-reproduction-example / commit (08ac11c57f7826cb038f07f5f72ede21cbcff242)[https://github.com/dtanzer/tauri-reproduction-example/commit/08ac11c57f7826cb038f07f5f72ede21cbcff242]
  • Install the dependencies and start the App
  • Click the buttons "Open Directory" or "Is Maximized?" -> The app becomes unresponsive and does not recover (The third button works for me)

Expected behavior

The app continues to accept user input after an API call

Platform and versions

[✔] Environment
    - OS: Windows 10.0.22621 X64
    ✔ WebView2: 115.0.1901.203
    ✔ MSVC:
        - Visual Studio Build Tools 2017
        - Visual Studio Build Tools 2022
    ✔ rustc: 1.71.0 (8ede3aae2 2023-07-12)
    ✔ Cargo: 1.71.0 (cfd3bbd8f 2023-06-08)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)        
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 20.5.0
    - npm: 9.8.0

[-] Packages
    - tauri [RUST]: 2.0.0-alpha.11
    - tauri-build [RUST]: 2.0.0-alpha.8
    - wry [RUST]: 0.31.1
    - tao [RUST]: 0.22.2
    - @tauri-apps/api [NPM]: 2.0.0-alpha.6
    - @tauri-apps/cli [NPM]: 2.0.0-alpha.11        

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

Stack trace

No response

Additional context

No response

@dtanzer dtanzer added status: needs triage This issue needs to triage, applied to new issues type: bug labels Aug 22, 2023
@kris-ava
Copy link

I am seeing the same happen after I call window.current_monitor().

@FabianLars
Copy link
Member

Thanks for the report! We're currently all out of office so there may be a bit of an delay but for what it's worth, i see the same behavior on macos.

@ImUrX
Copy link

ImUrX commented Aug 22, 2023

image

@simonhyll
Copy link
Sponsor Contributor

The issue appears to be related to the IPC mixing up the options with the payload to the function

@simonhyll
Copy link
Sponsor Contributor

simonhyll commented Aug 22, 2023

I've confirmed that changing the command argument name from options to optx resolves the issue

#[tauri::command]
pub async fn create<R: Runtime>(app: AppHandle<R>, optx: WindowConfig) -> Result<()> {
    tauri::window::WindowBuilder::from_config(&app, optx).build()?;
    Ok(())
}

Even just when setting an argument to options in a regular command it'll fail

#[tauri::command]
fn greet(options: &str) -> String {
    format!("Hello, {}! You've been greeted from Rust!", options)
}

So yea the issue appears to be that the IPC is unpacking the payload into the same object as the options

const { data } = processIpcMessage({ cmd, callback, error, options, ...payload })

@dtanzer
Copy link
Author

dtanzer commented Aug 27, 2023

Not sure if that's related, but on 2.0.0-alpha.10, running

import { documentDir, resolveResource } from '@tauri-apps/api/path'
//...
await documentDir()

in javascript code gives me the following error message (same for await resolveResource('[something]'), but AFAICS that's calling the same code under the hood):

invalid args `directory` for command `resolve_directory`: command resolve_directory missing required key directory

BUT on 2.0.0-alpha.11, this call works! Unfortunately, I cannot update because of this bug...

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

5 participants