i need someone who knows electron, am practicing my knowledge at electron,
Am making a kind of basic hotel system, the renderer.js haves this showReservDetails() and takes the reservation id, and i have the channel 'sent-data' in ipcRenderer, and whenever the ipcMain sends a response to any channel, it also sends something to the 'sent-data' channel just for debugging, and it sends the wantedreservation datails as an object, and it sends the object only one time, and the showReservDetails is bieng called only once, but when i log the data.wantedReserv it loggs it two times, for some reason, check the code, and i will be providing every needed line of code or console.log. in my JS when i click on some button it does execute the showReservDetails passing it argument, the first time i click on one of these buttons, it loggs once data.wantedReserv, and the second time it loggs it twice, third time i click the button it loggs it three times, and so on, and i forgot to note that sending to ipcMain from showReservDetails is only on time.
So every logged object as { need: "" } is a request from renderer.
And every showReservDetails in console called is a call for showReservDetails,
and every Back-end has sent data in console is a message from main process have been sent to some channel.
The problem was not discovered for now, But i've solved it by using invoke function in ipcRenderer:
ipcRenderer.invoke('channel', data, data2);
and must be handled or it will throw an error:
ipcMain.handle('channel', (event, data) => {})