question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lost Settings on Unexpected Shutdowns

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Comments:30 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
jarubacommented, Sep 27, 2018

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.

0reactions
appuristcommented, Sep 21, 2020

Also, you’re welcome to give Electron Settings v4 a shot: https://github.com/nathanbuchar/electron-settings/tree/v4, note however that there are quite a few significant/breaking changes. I don’t have any documentation written up for it yet, but I’m sure you could figure it out by looking at the source code and the tests. I’m nothing if not verbose in my commenting

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 .delete method 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found