thesamim / TickTickSync

GNU General Public License v3.0
160 stars 12 forks source link

Items are not deleted - delete popup always reappears #50

Closed Sigurdur42 closed 9 months ago

Sigurdur42 commented 10 months ago

Hi, I have the issue that items deleted in ticktick are not deleted in Obsidian. I get the deletion popup, confirm deletion and at next sync, the same happens again without deleting the items. Any idea how I can solve this? 2024-01-26_07-30

thesamim commented 10 months ago

Could you please turn on Debug Mode from Settings, Sync, and send me the output from the console? Edit: What version are you on?

Sigurdur42 commented 10 months ago

I have done so.

My system information:

{
  "process": {
    "arch": "x64",
    "platform": "win32"
  },
  "app": {
    "internalPlugins": {
      "config": {
        "file-explorer": true,
        "global-search": true,
        "switcher": true,
        "graph": true,
        "backlink": true,
        "canvas": true,
        "outgoing-link": true,
        "tag-pane": true,
        "properties": true,
        "page-preview": true,
        "daily-notes": false,
        "templates": true,
        "note-composer": true,
        "command-palette": true,
        "slash-command": false,
        "editor-status": true,
        "bookmarks": true,
        "markdown-importer": false,
        "zk-prefixer": false,
        "random-note": false,
        "outline": true,
        "word-count": false,
        "slides": false,
        "audio-recorder": false,
        "workspaces": false,
        "file-recovery": true,
        "publish": false,
        "sync": true,
        "starred": true
      }
    },
    "isMobile": false,
    "plugins": {
      "enabledPlugins": [
        "obsidian-tasks-plugin",
        "novel-word-count",
        "obsidian-projects",
        "obsidian-outliner",
        "emoji-magic",
        "obsidian-better-command-palette",
        "cm-editor-syntax-highlight-obsidian",
        "nldates-obsidian",
        "obsidian-icon-folder",
        "markdown-table-editor",
        "obsidian-style-settings",
        "mermaid-tools",
        "vault-name-status-bar",
        "obsidian-reminder-plugin",
        "obsidian-jira-issue",
        "vim-yank-highlight",
        "tickticksync",
        "table-editor-obsidian"
      ],
      "manifests": {
        "cm-editor-syntax-highlight-obsidian": {
          "version": "0.1.3"
        },
        "folder-notes": {
          "version": "1.7.5"
        },
        "homepage": {
          "version": "3.6.0"
        },
        "markdown-table-editor": {
          "version": "0.3.1"
        },
        "mermaid-tools": {
          "version": "1.1.1"
        },
        "nldates-obsidian": {
          "version": "0.6.2"
        },
        "novel-word-count": {
          "version": "3.0.1"
        },
        "obsidian-better-command-palette": {
          "version": "0.17.1"
        },
        "obsidian-icon-folder": {
          "version": "2.10.0"
        },
        "obsidian-jira-issue": {
          "version": "1.56.0"
        },
        "obsidian-outliner": {
          "version": "4.8.0"
        },
        "obsidian-projects": {
          "version": "1.17.1"
        },
        "obsidian-reminder-plugin": {
          "version": "1.1.15"
        },
        "obsidian-style-settings": {
          "version": "1.0.7"
        },
        "obsidian-tasks-plugin": {
          "version": "6.0.0"
        },
        "table-editor-obsidian": {
          "version": "0.20.1"
        },
        "tickticksync": {
          "version": "1.0.14"
        },
        "vault-name-status-bar": {
          "version": "1.1.1"
        },
        "vim-yank-highlight": {
          "version": "1.0.8"
        }
      }
    },
    "vault": {
      "config": {
        "accentColor": "#ef6b93",
        "cssTheme": "Heboric",
        "theme": "obsidian",
        "baseFontSize": 16,
        "readableLineLength": false,
        "showLineNumber": true,
        "alwaysUpdateLinks": true,
        "attachmentFolderPath": "./Attachments",
        "promptDelete": false,
        "pdfExportSettings": {
          "pageSize": "A4",
          "landscape": false,
          "margin": "0",
          "downscalePercent": 100
        },
        "vimMode": true
      }
    }
  },
  "plugin": {
    "settings": {
      "values": {
        "styleLists": true,
        "debug": false,
        "stickCursor": "bullet-and-checkbox",
        "betterEnter": true,
        "betterTab": true,
        "selectAll": true,
        "listLines": false,
        "listLineAction": "toggle-folding",
        "dnd": true,
        "previousRelease": "4.7.0",
        "dndExperiment": false
      }
    }
  }
}

log file is attached obsidian.md-1706515571911.log

Shall I send anything else?

thesamim commented 10 months ago

Thanks.

Now we know why the items are not being deleted, but not why it's not finding a project file for the "Welcome To..." task:

plugin:tickticksync:68108 An error occurred while synchronizing: Error: File not found for Welcome to TickTick  . File path found is null
    at FileOperation.deleteTaskFromFile (plugin:tickticksync:67285:13)
    at async SyncMan.syncTickTickToObsidian (plugin:tickticksync:68069:13)
    at async TickTickSync.scheduledSynchronization (plugin:tickticksync:68568:24)
    at async eval (plugin:tickticksync:68368:58)

Did you by any chance delete the list that this and the other tasks that are not deleted were in?

Let me make sure I understand the situation:

  1. you deleted the tasks from TickTick
  2. you may, or may not, have deleted the List that the tasks were in (I'll wait for your confirmation)
  3. you are getting notification that the tasks are going to be deleted
  4. but the tasks are never actually deleted from the file

Is that correct?

If it is, I know how we should take care of the issue. If it's not, I need a bit more detail about which list the task is in/was in....

Sigurdur42 commented 10 months ago

Hi, I do have deleted the md file in Obsidion as well - a list which I do not use in my vault. Other tasks from a list which still exists as md file are also reported as not delted.

Basically you are correct. Unfortunately, I do not see the name which is not found nor some more context details :( Does the sync go through all files in my vault? Is there a way to only sync items of a specific list?

tangyuan233 commented 10 months ago

Hi, I'm experiencing the same thing, I've tried deleting the data.json in the plugin folder, but the delete popup still keeps coming up lol

thesamim commented 10 months ago

@Sigurdur42, @tangyuan233 :

I believe I have found the bug that is causing all this. Apologies for the pain this has caused.

In order to validate that I have fixed it, Could you please:

  1. open <vault folder>\.obsidian\plugins\tickticksync\data.json, in a text editor
  2. search for fileMetadata
  3. This will contain a list of files from your vault that contain, or contained, tasks
  4. Let me know: is there a difference in the list of files? Does the TickTickCount match the number of tasks you expect to see in that file? is there a defaultProjectId for that file?

The bug I found is that the fileMetataData was not being properly updated on Task deletion. Which left things in bad shape. Your findings will confirm this for me, or point out if there's another issue.

Thanks in advance.

Sigurdur42 commented 10 months ago

Hi, Yes, the file list does not match. There are files listed which never contained tasks but this is also not all files from my valut (the valut is much larger). Maybe a problem could also be that there is an emoji in one of the file names - could this also lead to issues? 2024-01-31_08-25

At least one md file is missing because I deleted it - the 00 Inbox Private - the lower one from the TickTick screen shot

tangyuan233 commented 9 months ago

Hi, I'm not sure if the file list matched cause I used to put tasks on more than 500+ journal pages. I just checked console output, it looks like this is although this 'Study' project was deleted in ticktick, I also deleted the md file, and the fileMetadata part doesn't have this project as well, but data.json still have those info in TickTickTasksData section.

CleanShot 2024-01-31 at 19 19 37@2x

CleanShot 2024-01-31 at 19 30 30@2x

thesamim commented 9 months ago

Hi, Yes, the file list does not match. There are files listed which never contained tasks but this is also not all files from my valut (the valut is much larger).

Ok, will test that scenario.

Maybe a problem could also be that there is an emoji in one of the file names

No, Emojis in file names or directories is fine.

At least one md file is missing because I deleted it - the 00 Inbox Private - the lower one from the TickTick screen shot

That should have been handled ok. Will verify if the fixes I made take care of that.

Thanks for your input.

thesamim commented 9 months ago

@tangyuan233 : Thanks. Will test that scenario.

thesamim commented 9 months ago

@Sigurdur42, @tangyuan233 : could you please retest with version 1.0.16?

Sigurdur42 commented 9 months ago

Hi, I have tested this now a couple of days and it works for. Great Job!

thesamim commented 9 months ago

Hi, I have tested this now a couple of days and it works for. Great Job!

Glad to hear it. Thanks and thanks for you support!