deno-webui: [bug] deno-webui crashes if you open a window after closing all windows

If at any point you close all windows spawned by deno-webui, you will be unable to spawn any new windows as deno will crash from an uncaught error:

error: Uncaught (in promise) Error: unable to start the browser
      throw new WebUIError(`unable to start the browser`);
            ^
    at WebUI.show (https://deno.land/x/webui@2.5.0/src/webui.ts:105:13)
    at file:///.../deno-webui/examples/hello_world/hello_world.ts:125:10
    at eventLoopTick (ext:core/01_core.js:214:9)

To see this bug in action, simply modify the hello_world.ts example so that it works like this:

// Show the window
myWindow.show(myHtml); // Or myWindow.show('./myFile.html');

// Wait until all windows get closed
await WebUI.wait();

console.log("Thank you.");

// Show the window again
myWindow.show(myHtml); // Crash here!

// Wait until all windows get closed again
await WebUI.wait();

This happens to me on Windows 11.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 25 (25 by maintainers)

Most upvoted comments

I understand, thank you for the explanation. Meanwhile I can live without setMultiClient(true) while developing 🙂

No problem, I’ve created a pull request.

Success!

Jumping to that commit id and testing with your code appended to the hello_world.ts example I get new windows after closing the previous one and no errors!

Thank you for the incredibly fast response. 👌