tauri icon indicating copy to clipboard operation
tauri copied to clipboard

Dialog open speed very slow

Open HuakunShen opened this issue 1 year ago • 9 comments

Discussed in https://github.com/tauri-apps/tauri/discussions/6666

Originally posted by HuakunShen April 8, 2023 I am building an app that requires reading file path.

The tauri dialog open api works but took 2 seconds to open the window, which is unusal comparing to a normal browser.

It doesn't seem to be a problem with the frontend framework. I tried with both nuxt and sveltekit, and both opens slowly.

HuakunShen avatar Apr 10 '23 19:04 HuakunShen

I have same problem on macOS, invoked from React. In Safari opening file dialog is fast, in Tauri it takes about 2 seconds.

skurovec avatar Apr 10 '23 20:04 skurovec

I have same problem on macOS, invoked from React. In Safari opening file dialog is fast, in Tauri it takes about 2 seconds.

I just tried the same app on ubuntu, it opens quickly. On MacOS it's slow. Haven't experimented on Windows yet.

HuakunShen avatar Apr 11 '23 03:04 HuakunShen

I notice that the first time I use a file dialog in macos safari, it's very slow. The next couple uses are a lot faster, and then the dialog opens very fast. Same goes for macos firefox. When I repeatedly open a file dialog in a tauri app on macos, it stays consistently slow. I wonder if the dialog instance is intended to be reused?

djeikyb avatar Apr 12 '23 15:04 djeikyb

It seems that if you include a title that the dialog opens a lot faster.

open({ directory: true, multiple: false, title: "Select a project", defaultPath: await appDataDir(), })

jeffreybos avatar May 16 '23 20:05 jeffreybos

It seems that if you include a title that the dialog opens a lot faster.

open({ directory: true, multiple: false, title: "Select a project", defaultPath: await appDataDir(), })

This works perfectly for me. Thank you!

Not sure if we want to close this issue because this is kind of like a work around.

HuakunShen avatar Jun 06 '23 18:06 HuakunShen

I figure an update to a doc somewhere would do the trick of closing! I'm not quite sure where as yet tho

djeikyb avatar Jun 09 '23 00:06 djeikyb

to be honest i'd much rather have a fix for this than a doc update closing this issue. Worst case we'll just have to add a default title (on top of the doc update)?

FabianLars avatar Jun 09 '23 14:06 FabianLars

Having the same issue. The title helps but still slow. I am also getting the CATransaction error with the opendialog call was wondering if these issues are related?

https://github.com/tauri-apps/tauri/issues/6189

MclAidan avatar Jun 10 '23 19:06 MclAidan

It seems that if you include a title that the dialog opens a lot faster.

open({ directory: true, multiple: false, title: "Select a project", defaultPath: await appDataDir(), })

Use this method to fix the problem, but still prompt +[CATransaction synchronize] called within transaction

AskeyNil avatar Jun 18 '23 05:06 AskeyNil

This works perfectly for me. Thank you!

This works perfectly for me. Thank you!

jaaronkot avatar Sep 01 '23 14:09 jaaronkot