devtools
devtools copied to clipboard
Creating a window with devtools installed hangs main thread
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
- Create a new Tauri project or use an existing one.
- Follow the installation guide, installing it as a plugin
- 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);
});
- 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
devtoolsplugin is removed from the Tauri builder configuration in the app's main function. - No error messages are displayed in the console or terminal.