You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
localStorage doesn't persist on Linux + Windows #1731
@CharlieHess, by 'all platforms" do you mean all OSes Electron supports because I just tested Electron 0.26 x64 on Windows 10 preview and ran through the steps @paulcbetts mentioned and 'foo' is persisting for me.
@frankhale Yep, that's what I meant. However, now that I check Electron Win32 x64, it doesn't repro either. Maybe this has to do with how you exit Electron?
I haven't looked into it yet, but if the app crashes when quitting, or you use other ways like process.exit instead of app.quit to quit, the localStorage will not be persisted.
So, it turns out that we were calling out to app.exit instead of app.quit. I can't find any documentation on this method, but modifying all of our calls to use quit make localStorage persist as expected. I think we can close this one out. 😅
Reacted by Michael Calkins, Vitor Martins and Yuri Camara
I meet the same problem with win10. When I am using an mapapi , it's js will judge whether the localstorage works, but the result is localstorage does not work. electron 0.34.2.
using electron 1.1.0 and lcoalStorage is not persisting. Any help is kindly appreciated. I am accessing local storage from browser window (rendered process)
Even closing an application with "X" window button does not persist local storage, which seems to be the correct way to close an app. Electron needs a little help to prevent this. This is the helpful answer that resolved the issue for me: #5708 (comment)
Even closing an application with "X" window button does not persist local storage, which seems to be the correct way to close an app. Electron needs a little help to prevent this. This is the helpful answer that resolved the issue for me: #5708 (comment)
Activity
hanzhao commentedon May 20, 2015
On ArchLinux, it's all right.
CharlieHess commentedon May 20, 2015
This is more severe; it's actually happening on all platforms.
frankhale commentedon May 20, 2015
@CharlieHess, by 'all platforms" do you mean all OSes Electron supports because I just tested Electron 0.26 x64 on Windows 10 preview and ran through the steps @paulcbetts mentioned and 'foo' is persisting for me.
CharlieHess commentedon May 20, 2015
@frankhale: Tested on Windows 8.1 and Yosemite. We're accessing
localStoragefrom the renderer process (if that matters).[-]localStorage doesn't persist on Linux[/-][+]localStorage doesn't persist on Linux + Windows[/+]frankhale commentedon May 20, 2015
I assumed (most likely incorrectly) in @paulcbetts steps to reproduce that it was implied to open up Dev Tools and set / get 'foo' using the console.
anaisbetts commentedon May 20, 2015
@frankhale Yep, that's what I meant. However, now that I check Electron Win32 x64, it doesn't repro either. Maybe this has to do with how you exit Electron?
zcbenz commentedon May 21, 2015
I haven't looked into it yet, but if the app crashes when quitting, or you use other ways like
process.exitinstead ofapp.quitto quit, the localStorage will not be persisted.CharlieHess commentedon May 21, 2015
So, it turns out that we were calling out to
app.exitinstead ofapp.quit. I can't find any documentation on this method, but modifying all of our calls to use quit makelocalStoragepersist as expected. I think we can close this one out. 😅nicozhang commentedon Nov 6, 2015
I meet the same problem with win10. When I am using an mapapi , it's js will judge whether the localstorage works, but the result is localstorage does not work. electron 0.34.2.
bansalvks commentedon May 26, 2016
using electron 1.1.0 and lcoalStorage is not persisting. Any help is kindly appreciated. I am accessing local storage from browser window (rendered process)
anaisbetts commentedon May 26, 2016
LocalStorage won't persist if you kill the app via Ctrl-C or some other violent means, this is almost certainly the bug y'all are seeing
Lt0 commentedon Oct 12, 2018
I have the same issue on win10 when I reinstall my electron app. I just remove C:\Users\Lt0\AppData\Roaming\my-app-name to make it work.
MutableLoss commentedon Apr 8, 2019
I'm running into this with my Linux builds when using app.quit(), though the Windows and OSX builds have no issues persisting at all.Electron: 4.0.2Update: somehow the app's .config folder was owned by another user, blocking storage of the local storage.
knaos commentedon Nov 25, 2021
So what if we want to prevent this behaviour? Is it still a bug.
anaisbetts commentedon Nov 25, 2021
If you want to prevent this behavior, exit your application correctly and it won't happen 💃
mcharytoniuk commentedon Dec 7, 2021
Even closing an application with "X" window button does not persist local storage, which seems to be the correct way to close an app. Electron needs a little help to prevent this. This is the helpful answer that resolved the issue for me: #5708 (comment)
Calling
app.quit()manually in this event might be even more reliable: https://nodejs.org/api/process.html#event-beforeexitamoscatelli commentedon Jan 22, 2022
Are using localestorage from main process or renderer process ?
Even when using
process.on('exit', () => app.quit());
my renderer process seems to lose data in localstorage when closing the application with "X"