Lost Settings on Unexpected Shutdowns
See original GitHub issueI have an issue with the current PC where it just restarts randomly sometimes. Every time it happens, if the app that uses this module is running, the entirety of the db from electron-settings gets completely wiped out.
Is my assumption that this cannot be corrected and I should look for a “more persistent” db solution correct?
Issue Analytics
- State:
- Created 5 years ago
- Comments:30 (10 by maintainers)
Top Results From Across the Web
Fixed: Error “Windows has Recovered from an Unexpected ...
Method C: Change Startup and Recovery Settings · Right-click on This PC. · Go to Properties and click System Protection. · Click on...
Read more >Unexpected Shutdown – Missing Data? Get It Fixed Here
PC unexpected shutdown can be caused by many reasons including power outages, brownouts, depleted laptop battery or removed power cord. Besides, ...
Read more >Windows Has Recovered From An Unexpected Shutdown ...
In the Windows RE, switch to Troubleshoot > Advanced options. · Now, select Startup Settings. · Next, press 5 or F5 to start...
Read more >Windows Has Recovered From an Unexpected Shutdown
Fix 1: Disable/Uninstall Dubious Drivers · Fix 2: Perform a Clean Boot · Fix 3: Change Settings in Startup and Recovery · Fix...
Read more >What is the cause of Windows 10 unexpected shutdown?
Method 3: I would suggest you to restore default settings of power plan and check if it helps. 1. Open Control Panel. 2 ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

My OS is Windows 10, not sure if this is OS specific, it kind of feels like electron-settings is keeping all changes in memory and only saving to file on app close.
If my presumption is true though, it would be awesome if we could also save manually. As I could make it save on a 60 min interval.
I’ve upgraded to electron-settings 4.x and indeed plenty of breaking changes, none of which seem documented anywhere in the 2.5 years since this comment. I’ve been googling and this Issue is the closest thing I’ve found to any form of confirmation or documentation of the breaking changes in 4.x. There aren’t even any release notes with the 4.0.0 upgrade (or any electron-settings releases). No support at all for existing users trying to make their existing code function after these changes.
Edit to add: I am aware of the 4.0 documentation at https://electron-settings.js.org/ but I’m referring to some form of list or guide for 3.x to 4.x migration. There isn’t even any references in the 4.x documentation to breaking changes made.
Depending on how your code is structured, for others looking for answers on this, the symptom is sometimes “Error: An object could not be cloned.” (or a warning about unresolved promises). See https://github.com/electron/electron/issues/23722 for more.
Since there are major breaking changes, I would have expected at least a short table of old functions and parameters mapped to new functions and parameters. It also looks like some functions may have just been outright removed (is the
.deletemethod just gone now)? This has cost me the better part of a day, because there is no documentation for the major upgrade and breaking changes.I initially just rolled back to 3.x for now, but then eventually attempted to complete an upgrade again. I am abandoning that now due to a lack of migration documentation, and going to proceed by eliminating my use of electron-settings going forward.
I already had a scheme similar to the design @ashleydavis came up with (remote IPC to coordinate a single instance of settings data). I’m going to do away with the settings entirely and just have the main process code ask the renderer for localStorage data. This means it won’t be available until after the mainWindow is available, but I can adjust the window after it is opened, before a mainWindow.show() and achieve the same results without this added dependency.
I’m very disappointed by the cavalier “it’s a x.0 upgrade anyway” attitude above, and while that may be true, without documenting the migration needed to go from 3.x to 4.x, it puts a large unnecessary burden on the developer who previously adopted your library.