Javascript error on Menu Item click after page reload
Hi, I am building a simple one page electron app with a simple HTML page with a menu using sample code shown here: [https://github.com/atom/electron/blob/master/docs/api/menu.md]
But I am getting a javascript error on SECOND page reload on a simple electron app. Note that this error only comes if I reload the app once and then click View->Reload again.
"Uncaught exception error: Attempting to call a functions in the renderer window that has been closed or released. Function provided here: undefined".
I have even gone through this case but did not understand how to remove call back reference for my simple case. Here is the code I have in my simple HTML page:
https://jsfiddle.net/fb2a3ho6/
I would like to know why on second refresh, when reference to the old window is lost, I am getting an error.
Vivek
This is a bug of Electron, somehow the render-view-deleted event is emitted after the page gets reloaded, making the code to clear renderer callbacks at wrong time.
Not sure if this is the right forum to ask this, but any idea when this bug would be fixed?
.. or is there any way to work around it ?
I am also having the same issue. What is the workaround for this? All subsequent reload calls are also blocked in the application.
In my case i ended up avoiding page reload. I performed the task that needed reload on a new separate window.
Also having this issue. Have to disable reloading now.
Yeah, my project is hitting the bug too. Have to use an older electron version because of this.
I still hit this error now, electron version 1.4.8
[Window Title]
Error
[Main Instruction]
A JavaScript error occurred in the main process
[Content]
Uncaught Exception:
Error: Attempting to call a function in a renderer window that has been closed or released. Function provided here: mycard.component.js:28:28.
at BrowserWindow.callIntoRenderer (D:\Github\mycard\node_modules\electron\dist\resources\electron.asar\browser\rpc-server.js:199:19)
at emitOne (events.js:101:20)
at BrowserWindow.emit (events.js:188:7)
[确定]
my code around mycard.component.js:28:28:
currentWindow = remote.getCurrentWindow();
...
this.currentWindow.on('maximize', () => ...);