Upgrading to 1.7.0-beta0 blew away my session - any way to restore?


#1

I previously had atom 1.6.0-beta8 installed.

Atom did an auto-update to 1.7.0-beta0, and now my session (with opend documents, unsaved docs and changes etc.) is gone.

Is there any way to restore this?

Is it normal that your session is reset when you do auto-updates?

I know that previously, before it was part of Atom core, the autosave plugin stored your session in a projects.json file. Is there an equivalent in Atom core? It’s quite annoying this happened


#2

But not unpredictable since it is beta.


#3

Just want to chime in here. I am not an atom core maintainer nor do I have any official knowledge. This is purely from my knowledge gained from reading the source code.

This is completely expected and will happen even when 1.7 reaches stable. It’s due to atom changing how and where they serialize state.

Your state isn’t gone… rollback manually to 1.6.x and it’ll come back.

Now, I can think of a way to “migrate” state and will try to find an hour to do so. Perhaps atom 1.7 can either migrate on load or change the state process to read from either location. Yes… the latter is probably better. I’ll try to find time to do a PR but it’s a pretty simple change. On loadState in state-store.coffee we just need to fallback to the previous load code if we can’t find state in the new location.


#4

@mehcode Aha, thanks for the super-helpful info =).

Hmm, I didn’t realise the state format had changed. I guess that makes more sense now.

I just tried download Atom 1.6.0 (stable), and running that, and it didn’t restore my session from Atom 1.6.0-beta8. However, I don’t know if that’s related to my having started up Atom 1.7.0 already once.

I do notice in ~/.atom.storage, there are two files:

bash-3.2$ ls -lah
total 5344
drwxr-xr-x   5 victorhooi  eng   170B Mar 22 11:17 .
drwxr-xr-x  14 victorhooi  eng   476B Dec 20 02:10 ..
-rw-r--r--   1 victorhooi  eng    70B Mar 22 11:17 application.json
-rw-r--r--   1 victorhooi  eng   2.6M Mar 22 10:15 editor-42a7ca50b587f5ce7b37d83ea6b903e79db6ca9e
-rw-r--r--   1 victorhooi  eng   1.8K Mar 22 11:17 editor-d195817992ad4093f8d96a33840bf58d4961cdb0

Just from the time-stamps, it’s possible that editor-42a7ca50b587f5ce7b37d83ea6b903e79db6ca9e might actually be my old session state. Is there any way to manually force using this file, or open it up manually in Atom?


#5

Editor state is now stored in indexeddb. Which is not accessible easily on the file system. That folder you have is what 1.6 and before read from.

I don’t know why your state wouldn’t be restored if you rolled back. That’s odd. I’ve tested it before and it worked.


#6

Hmm, does the fact there are two editor- files mean anything?

Is there a pointer somewhere that tells Atom which one to read?

(Could Atom might be reading the other one - which is 1.8 K, rather than the 2. 6 MB one?)


#7

Atom serialized it’s state per path set. So… if you use the open command and pick the same two folders you’ve opened before atom will remember your open files / etc. Those 2 files just represent 2 different path sets that you’ve opened.


#8

So for the 1.8 Kb file, at the top I have:

{"version":1,"windowDimensions":{"x":2104,"y":648,"width":1440,"height":797,"maximized":false},"grammars":{"grammarOverridesByPath":{}},"project":{"deserializer":"Project","paths":["/Users/victorhooi/Documents"],"buffers":[]},

So it seems like one of the paths is just /Users/victorhooi/Document

For the 2.6 MB file, I see:

{"version":1,"windowDimensions":{"x":0,"y":23,"width":1440,"height":797,"maximized":true},"grammars":{"grammarOverridesByPath":{}},"project":{"deserializer":"Project","paths":["atom://config"],"buffers":[{"id":"7b2d0f3cf8185460590b8a86450ffe08",

The path is atom://config? Sorry to bother you again - but how would I re-open that path?


#9

Cheap way is to rename the big file to use the small files name. Atom calculates the file name from the path.


#10

Good news.