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

[example] API example is unresponsive when opening on Windows #571

Closed
FlysoftBeta opened this issue Aug 16, 2023 · 11 comments
Closed

[example] API example is unresponsive when opening on Windows #571

FlysoftBeta opened this issue Aug 16, 2023 · 11 comments
Labels
bug Something isn't working status: upstream This issue needs to be fixed in an upstream project

Comments

@FlysoftBeta
Copy link

FlysoftBeta commented Aug 16, 2023

Hello, I'm building the official API example on my Windows machine with following commands:

git clone [email protected]:tauri-apps/plugins-workspace.git && cd plugins-workspace/examples/api
touch yarn.lock
yarn install
yarn tauri build

Click on the output executable, the window opens, but it quickly becomes unresponsive.
screenshot

Output of yarn tauri info

[✔] Environment
    - OS: Windows 10.0.22621 X64
    ✔ WebView2: 115.0.1901.203
    ✔ MSVC: 
        - Visual Studio Community 2022
        - Visual Studio ���ɹ��� 2019
    ✔ rustc: 1.71.1 (eb26296b5 2023-08-03)
    ✔ Cargo: 1.71.1 (7f1d04c00 2023-07-29)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 18.17.0
    - pnpm: 8.6.12
    - yarn: 3.6.1
    - npm: 9.6.7

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

[-] App
    - build-type: bundle
    - CSP: connect-src ipc: https://ipc.localhost; default-src 'self' customprotocol: asset:; img-src 'self' asset: https://asset.localhost blob: data:; font-src https://fonts.gstatic.com; style-src 'unsafe-inline' 'self' https://fonts.googleapis.com
    - distDir: ../dist
    - devPath: http://localhost:5173/
    - framework: Svelte
    - bundler: Vite

Edit: I tried calling dialog.open on a separate app, it becomes unresponsive too.🫤

@reyamir
Copy link

reyamir commented Aug 17, 2023

not sure same issue or not
but in my app, it hang if using fetch from HTTP or Stronghold plugin (latest tauri v2.0.0-alpha.11)

@zitiger
Copy link

zitiger commented Aug 19, 2023

Same issue in Mac too.

How to reproduce it:

  1. create a new app with create-tauri-app
  2. Add following code in Greet.vue
    import { message } from '@tauri-apps/plugin-dialog';
  3. and following in greet() of Greet.vue
    await message('Tauri is awesome', 'Tauri');
  4. run the project and click Greet button, the app is unresponsive.

I tested message and open function, both are unresponsive.

@reyamir
Copy link

reyamir commented Aug 19, 2023

same issue in my mac too
I guess this issue cause by new IPC

@dfrnoch
Copy link

dfrnoch commented Aug 19, 2023

same issue in my mac too I guess this issue cause by new IPC

Most probably. In my case, getting the current theme from the window plugin and maximizing the app by double clicking will cause the app to freeze indefinitely (using data-tauri-drag-region)

@reyamir
Copy link

reyamir commented Aug 19, 2023

same issue in my mac too I guess this issue cause by new IPC

Most probably. In my case, getting the current theme from the window plugin and maximizing the app by double clicking will cause the app to freeze indefinitely (using data-tauri-drag-region)

same with HTTP plugin, Stronghold plugin freeze few second but still work fine after that

@zitiger
Copy link

zitiger commented Aug 19, 2023

same issue in my mac too I guess this issue cause by new IPC

Most probably. In my case, getting the current theme from the window plugin and maximizing the app by double clicking will cause the app to freeze indefinitely (using data-tauri-drag-region)

群主好,

to get theme , you can try the following way, it works well for me:

#[tauri::command]
pub fn get_theme(window: tauri::Window) -> Option {
let theme = window.theme();

if theme.is_ok() {
    Some(theme.unwrap().to_string())
} else {
    Some("dark".to_string())
}

}

@ImUrX
Copy link
Contributor

ImUrX commented Aug 22, 2023

This seems to be the actual issue:
image

@zitiger
Copy link

zitiger commented Aug 23, 2023

currently, i use rfd directly to fix this issue temp.

use rfd::{FileDialog};

#[command]
pub fn open_folder() -> String {
let folder = FileDialog::new().pick_folder();
let folder = folder.unwrap_or_default();
String::from(folder.to_str().unwrap_or_default())
}

@yohannlog
Copy link

I've got the same issue (based on @ImUrX message) on linux. The problem is global to all platforms.

@LetrixZ
Copy link
Contributor

LetrixZ commented Sep 5, 2023

There is a fix for Linux: tauri-apps/tauri#7677
macOS and Windows still not working.

@pewsheen
Copy link
Contributor

pewsheen commented Sep 6, 2023

I guess this should be an issue in tauri-runtime-wry
https://github.com/tauri-apps/tauri/blob/29818de682146a75cd9a886f7b215154cad1d42d/core/tauri-runtime-wry/src/lib.rs#L2703-L2709

The protocol fn is not running asynchronously, so it's blocking the main thread and waiting for the response. But in the meantime, the response also needs to be sent back in the main thread causing a deadlock.

I think this PR may solve the issue, but it still needs to rewrite the tauri-runtime-wry to make it asynchronous.
tauri-apps/wry#1017

These issues might be related.

tauri-apps/tauri#7727
tauri-apps/tauri#7673
Discord | UI freezes even with async fn on new IPC - Tauri 2.0.0-alpha11

@FabianLars FabianLars added bug Something isn't working status: upstream This issue needs to be fixed in an upstream project labels Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working status: upstream This issue needs to be fixed in an upstream project
Projects
Status: 📬Proposal
Development

No branches or pull requests

9 participants