A note I found by accident can be searched, but I don’t know which directory it is in, so I use joplin data api to search for it, but the note’s parent_id can’t be found. I want to know what operations can cause this problem ?
Joplin 1.4.19 (prod, win32)
I just thought about it and I think it can happen in this case:
- Client 1 create folder 1
- Client 2 sync
- Client 2 create note inside folder 1
- Client 1 delete folder 1
- Client 1 sync
- Client 2 sync
=> Client 2 deletes folder 1 via sync, but the note that was created inside of it and was never synced will remain there as an orphaned note. I guess there should be a clean up step somewhere, when a folder is deleted via sync, to delete orphaned notes.
1 Like
I scanned it with api and found that 33 notes have no parent directory. I'm not sure what happened. Has anyone encountered the same problem?
The scan code looks like
const noteList = await PageUtil.pageToAllList(noteApi.list, {
fields: ['id', 'title', 'parent_id'],
})
const notParentNoteList: typeof noteList = await new AsyncArray(
noteList,
).filter(async (note) => {
try {
await folderApi.get(note.parent_id)
return false
} catch (e) {
return true
}
})
console.log(
'notParentNoteList: ',
notParentNoteList.length,
notParentNoteList,
)
In the end, I reassigned the directories for them, and besides, I'm sure I didn't operate as you said. . .
I'm not sure what happened
Maybe what I've described above?