devtools icon indicating copy to clipboard operation
devtools copied to clipboard

Creating a window with devtools installed hangs main thread

Open jamesa08 opened this issue 1 year ago • 3 comments

When the devtools crate is installed in a Tauri project, it prevents the creation of new windows using the WebviewWindow API. The window creation process hangs indefinitely without throwing an error or creating the window. Removing the devtools crate resolves the issue and allows windows to be created successfully.

  • Tauri version: 1.8.0
  • Rust version: 2021 1.60
  • Operating System: macOS Sonoma 14.3.1 (23D60) M1 Max
  • devtools crate version: 0.3.3
  • React version: 18.3.1
  • Vite version: 5.4.8

Steps to Reproduce

  1. Create a new Tauri project or use an existing one.
  2. Follow the installation guide, installing it as a plugin
  3. Run the following code in the window's browser. I am using a React+Vite app, but I have tested it on other environments.
const { WebviewWindow } = window.__TAURI__.window;

const newWindow = new WebviewWindow('test-window', {
  url: '/',
  title: 'Test Window',
  width: 800,
  height: 600,
  resizable: true,
});

newWindow.once('tauri://created', () => {
  console.log('Window successfully created');
});

newWindow.once('tauri://error', (e) => {
  console.error('Error creating window:', e);
});
  1. Attempt to create a new window by running this code.

Expected Behavior

The code should create a new window, and the console should log "Window successfully created".

Actual Behavior

The window creation process hangs indefinitely. No new window is created, and neither the success nor the error callback is triggered.

Workaround

Removing the devtools crate from the project resolves the issue. This can be done by running cargo remove devtools and removing any related code or imports.

Additional Information

  • The issue persists even if the devtools plugin is removed from the Tauri builder configuration in the app's main function.
  • No error messages are displayed in the console or terminal.

jamesa08 avatar Oct 03 '24 17:10 jamesa08

Thanks for the feedback, we will triage immediately. I have already spoken with @lucasfernog-crabnebula and we think we have a lead

denjell-crabnebula avatar Oct 03 '24 21:10 denjell-crabnebula

This was fixed for v2, but for v1 it probably takes more effort. I'll take a look.

lucasfernog-crabnebula avatar Oct 03 '24 21:10 lucasfernog-crabnebula

Thanks for the quick responses and patches!

jamesa08 avatar Oct 04 '24 01:10 jamesa08