usebruno / bruno

Opensource IDE For Exploring and Testing Api's (lightweight alternative to postman/insomnia)
https://www.usebruno.com/
MIT License
25.43k stars 1.16k forks source link

White screen on start when ELECTRON_IS_DEV=1 #1253

Open PeterBenko opened 9 months ago

PeterBenko commented 9 months ago

The main window is white when starting Bruno while the ELECTRON_IS_DEV env variable is set to 1. Importing / trying to import collections has no influence on the main window.

Tested on:

Its-treason commented 9 months ago

This is the relevant code:

https://github.com/usebruno/bruno/blob/d268b4786abe07861ffd41e636a19013804f5015/packages/bruno-electron/src/index.js#L64-L86

When starting in dev mode, Bruno tries to open http://localhost:3000. When run in production mode, Bruno opens the JavaScript bundle included in the app.

If you try to run Bruno from source, make sure to run npm run dev:web before starting electron.

PeterBenko commented 9 months ago

Nice, straight to the point! However, I would postulate that isDev isn't the right tool for this use case and should actually be app.isPackaged. In the recent times when developing an Electron app - and having ELECTRON_IS_DEV permanently turned on - I leaned to expect many other apps opening the dev tools, which I understand - it basically flips them into debug mode. However, none of them straight up broke like Bruno did. The decision to use the dev-server served content isn't something that should be based on the debug flag. I'd say it should either be a run argument (like --useDevServer) or the above mentioned app.isPackaged check. Is Bruno ever expected to run not packaged in production?

I'm open to creating a PR for either of the fixes :)

Its-treason commented 9 months ago

Yeah, you're right, app.isPackaged would totally be the better option here. You can create a PR for this, if you want, we would appreciate it.

PeterBenko commented 9 months ago

1260 is open :)

sebastian-xitaso commented 1 month ago

@Its-treason Any update on this? We develop an Electron based app for which we set Electron_is_dev to 1. This means we can't use Bruno at the same time.

Its-treason commented 1 month ago

@Its-treason Any update on this? We develop an Electron based app for which we set Electron_is_dev to 1. This means we can't use Bruno at the same time.

Hey, I just added my Approved to the PR, but I cannot give you an ETA on when this will be merged. But it is a small change, so probably soon. CC @sanjai0py for visibility.