debanjandhar12 / logseq-anki-sync

An logseq to anki syncing plugin with superpowers - image occlusion, card direction, incremental cards, and a lot more.
GNU Affero General Public License v3.0
421 stars 30 forks source link

Plugin marks existing cards in Logseq to be deleted in Anki #235

Open juli-p opened 6 months ago

juli-p commented 6 months ago

First of all, thank you for the great plugin! It speeds up my learning process so much.

Describe the bug I used the plugin for several month now without a problem. Yesterday however, it marked around 200 of my existing cards to be deleted in Anki during the sync even though these cards are still unchanged in Logseq. They are also not recognized as new cards but it rather seems the plugin does not "find" them in Logseq anymore. I did not change the affected pages in Logseq and I can still find the respective blocks in Logseq. The issue remains if I refresh my Logseq Graph.

The issue can be reverted for a card if I remove e.g., the #card #forward and add it back again. Then the plugin finds the card again and it is correctly matched to the existing card in Anki. I still wanted to report that issue because modifying 200+ cards is quite tedious and I do not know if this can happen again at some point.

Is it save to reindex Logseq when using this plugin? I was not able to find anything about the effects of reindexing on the behavior of this plugin. Maybe this would fix the issue.

Steps to Reproduce: I do not know how this issue exactly came up, but it may have something to do with the most recent Logseq/plugin update.

Expected behavior Existing and unchanged cards should not get deleted.

Device Information (please complete the following information):

juli-p commented 6 months ago

Today I noticed that, even though I was able to find the blocks via the Logseq search, they weren't listed as Linked References for the #card tag. Hence, I was able to fix the issue by replacing the #card tag with some other tag (e.g., #foo) and then back to #card in all my affected pages. So I guess that the issue was probably a pure Logseq issue and not directly related to this plugin. I am sorry for the false alarm.

I'm still interested to see if the mapping from Logseq to Anki survives a re-indexing of Logseq.

debanjandhar12 commented 6 months ago

I'm still interested to see if the mapping from Logseq to Anki survives a re-indexing of Logseq.

The plugin should survive a re-indexing... unless logseq messes up. I have done it several times and almost never faced an issue.

In this instance, the issue arose due to Logseq's messing up the "card" page reference specifically. This is a common occurrence, especially after re-indexing. The plugin relies on these references when scanning the graph, hence the problem. Personally, it never happened with me for "card" page but happened with other pages.