saltyshiomix / nextron

⚡ Next.js + Electron ⚡
https://npm.im/nextron
MIT License
3.97k stars 229 forks source link

Nextron Opens New Window with every Save #230

Closed m5x5 closed 2 years ago

m5x5 commented 2 years ago

At the moment, the renderer process starts every time I save my code. This results in a new Window. https://github.com/saltyshiomix/nextron/blob/f268182d49e0bcf7a532f8a7edff1f91fc96f84c/lib/nextron-dev.ts#L125

Details

If I put the new window to always on top to ignore the new windows, the renderer process continues to use the old state of the main process and my changes aren't visible. Only changes in the renderer process

Possible fixes

Seems like this line should check if the new process is a main process and then kill it if it is. On Windows 11 it seems like it's not working. (Not sure if it's possible, but what if we, instead of starting and killing it, didn't start it at all?) https://github.com/saltyshiomix/nextron/blob/f268182d49e0bcf7a532f8a7edff1f91fc96f84c/lib/nextron-dev.ts#L114

Expected Behaviour

Earlier I have been developing Nextron apps on Linux and there the Windows update, hot-reload like, no new windows and no unclosed old windows. I believe it'd be a much better developing experience if we hadn't to close 2 windows (inspector, renderer-window) every time we save our code.

System

OS: Windows 11
"devDependencies": {
  "@types/node": "^14.14.31",
  "autoprefixer": "^10.3.5",
  "electron": "^15.0.0",
  "electron-builder": "^22.11.7",
  "next": "^11.1.2",
  "nextron": "^7.1.0",
  "prisma": "^3.6.0",
  "react": "^17.0.2",
  "react-dom": "^17.0.2",
}

Thank you all for creating Nextron, it's a huge blessing! 🎉

SamHep0803 commented 2 years ago

I can reproduce and am also getting this issue on Windows 11, maybe a hotfix pull request could be made? Sounds like its a simple thing to fix

xuhaichaoy commented 2 years ago

same problem

pe3ep commented 2 years ago

same problem

m5x5 commented 2 years ago

I'm closing this issue as this is the same as #155