Can I Convert Cache to Graph?

My situation is probably very unusual, but I’m hoping someone can give me some advice.

I have a Logseq graph which I have stored in OneDrive to sync with two PCs and my phone. At some point in the past few months, a large number of my pages in this graph completely disappeared. Not all, but many. I don’t know exactly when it happened because I hadn’t tried to access any of the pages that disappeared for a few months. It was just a few days ago that I went to open one of them and saw it wasn’t there anymore. I’ve checked Logseq’s recycle folder, my local recycle bins and OneDrive’s recycle bin. None of the missing pages are there.

I am curious if anyone has any ideas about why that might have happened, but that’s not the main point of this post.

Here’s the important part: I discovered that Logseq on one of my PCs had opened an older version of this graph at some point when it was stored in a different location. I never disconnected that graph, and it appears to still have all the pages in it’s cache. I’ve been able to access all the missing pages I’ve looked for. I’m pretty sure they are all there.

Is there a way I can export/convert the cached version of this graph into a non-cached version, with all the .md files in a graph folder as usual? Then I can more easily move the data back into my main graph and sync it quickly with my other devices. Currently the only method I can see is to manually copy and paste the data from each missing page (in the cache) into a new version of the page (in my main graph).

I have tried searching for info on this but couldn’t find anything, so my apologies if it does exist already and I missed it. Thanks in advance for any ideas!

Welcome.

Most probably because of syncing, which is problematic.

This may cause further losses.

Low chances, but you may have some luck through the following:

  • Open the console with Ctrl + Shift + i
  • Try entering these two:
    • logseq.api.get_current_graph()
    • logseq.api.download_graph_db()

Thanks for your help!

Most probably because of syncing, which is problematic.

Is there a reliable way to sync or is all syncing just not a good option right now?

This may cause further losses.

“Sync” may not be the best word. Just being able to get a copy of my graph onto another PC faster than if I copy and paste each missing page’s content manually. Even just restoring the whole graph at once and copying via flash drive would be better.

Low chances, but you may have some luck through the following:

There’s quite a lot going on when I open the console. :sweat_smile: Not sure where to enter those lines.

Read this article and its links.

The console is right at the bottom, but better go to the Console tab at the top (near Elements). There is a simple prompt to enter the lines.

Thanks. It sounds like the links are referring specifically to Logseq’s Sync feature, which I haven’t used. All syncing for me has happened through OneDrive. Am I misunderstanding?

Ah, makes sense now. I entered the lines and was given a .transit file to download. I can’t find info on how to use this.

  • You may not have explicitly used it, but still something deleted those pages. I don’t have an alternative guess.
  • The links also refer to syncing ways that people use with acceptable reliability (for them anyway).

This is for importing to the database of the other device. Could have a look at tab Application → Storage (this should be inside the >> symbol at the top). Unfortunately, from this point on it gets too technical and I don’t see an easy way forward.

True, I’ve never had OneDrive delete files by itself before so it was likely Logseq. Thanks for the resource! I’ll do some research and see if I can find something that works for me.

I don’t see that exactly, but there is an “Import” option under the three horizontal dots menu. This does not allow me to import the .transit file. However…

I think I’ve found a solution: I was able to export my open cache as a .json from “3 dot menu > Export Graph”. When I imported this .json into another graph, all my pages seemed to come through with formatting intact! I haven’t checked all the missing pages, but the ones I have checked look correct. As far as I can tell, I’ve successfully retrieved my lost pages. :slight_smile:

@mentaloid Thanks again for your help! I really appreciate it!