mischnic / proton-hot-cli

Hot-reloading babel-node for proton-native apps
MIT License
0 stars 0 forks source link

Reloading <App> on Windows creates duplicate windows on every update #1

Open mischnic opened 6 years ago

mischnic commented 6 years ago

https://github.com/albe-rosado/create-proton-app/pull/18

when running npm run dev, and closing the window, the process does not exit

albe-rosado commented 6 years ago

Hi @mischnic , did you were able to identify the cause of this? I will take a look this weekend anyway. Thanks

mischnic commented 6 years ago

The issue title contains all I know ("reloading App" meaning reloading a component containing the App component). It might have something to do with libui.startLoop and libui.stopLoop.

I'll have to test it on Linux as well.

mischnic commented 6 years ago

@albe-rosado Have you found out anything?

albe-rosado commented 6 years ago

will do today after work @mischnic

mischnic commented 6 years ago

@albe-rosado Any news?

albe-rosado commented 6 years ago

Nope, hopefully, I will be able to do something this weekend, anything from your side?

mischnic commented 6 years ago

Unfortunately no. Yesterday I tested only if it has to do with the render methods in App and Root, but with no success so far. It seems to happen only when the App component is reloaded, but the only thing it does is handling onShouldQuit https://github.com/kusti8/proton-native/blob/master/src/components/App.js. So I guess it has to have something to do with this.renderChildNode(this); which calls render on the Window.

I just noticed that macOS is affected as well in that every App reload resets the window position.

Also strange: The Window render methods start with: if (!this.element) { this.element = new libui.UiWindow(...); But this.element is undefined on every render because the Windows seems get recreated every time.

https://github.com/kusti8/proton-native/blob/20819de67509cce67cd86377077ad86893304d6b/src/components/Window.js#L57-L65

albe-rosado commented 6 years ago

I will try my best to debug this in deep tomorrow. thanks a lot

mischnic commented 6 years ago

https://github.com/kusti8/proton-native/issues/180