Using jsonfile reloads page after writing to file


#1

I need to append some data to an external json file.
I figured out the best approach would be using the node package jsonfile but there seems to be a problem. When data is successfully written to the json file, the electron page I’m on gets reloaded on its own, instead of loading a different URL as stated in my code.

This is not what I want, I need to load a different URL (load a new page) after data gets successfully written into the json file. Is there anything I can do about it? Thanks in advance!

jsonfile.writeFileSync(file, data, { flag: 'a' }) <- appends data to an existing json file
ipcRenderer.send("changeWindow", "thankyou.html") <- loads the new URL into the window

#2

For anyone interested, it was my mistake.
I was using the electron-reload package, so any changes in the json file I was appending data to, caused the page to reload.