joplin-utils icon indicating copy to clipboard operation
joplin-utils copied to clipboard

[Bug]: Note name clashes and loss of data

Open globalhuman opened this issue 3 years ago • 2 comments

Confirmation

  • [X] I checked FAQ

The tool/kit where the error occurred

joplin-vscode-plugin

Describe the bug

I will describe a couple of bugs relating to a likely similar cause.

name clash issue:

When a note shares the same name a clash can occur which stops the user from changing between two identically named notes.

Missing data issue:

Another issue I have observed which relates the the temporary file naming used. This resulted in actual lost data due to the data not being synced.

Steps to reproduce the behavior

Overwritten data issue:

  • open notes.md found in folder folder1
  • open notes.md found in folder folder2

I am unable to change back to folder1/notes.md and I can only edit folder2/notes.md

Missing data issue:

  • open notes.md in vscode window
  • in vscode pallet Developer: Reload Window
  • add changes to notes.md
  • observe that no changes are made to the original file as synced to the joplin app.

I was fortunate that vscode has local history and I was able to restore the version using vscode functionality.

log file

Additional context

No response

globalhuman avatar Jun 25 '22 06:06 globalhuman

This question is a bit complicated and involves several issues

  1. Unable to determine when the vscode extension was run for the first time, if you know, you can clear the temporary file directory
  2. The vscode extension seems to have multiple processes when multiple windows are open, I'm not sure how to share data between multiple windows

rxliuli avatar Jul 16 '22 04:07 rxliuli

An idea is to start a local server so that there is only one instance of map. Record it here first, maybe I'll have time to implement it at the end of the week

rxliuli avatar Aug 10 '22 08:08 rxliuli

This just happened to me!

In you don't have vscode local history, you can just use joplin's note history feature which is native to joplin.

joplin history

serranomorante avatar Oct 31 '22 22:10 serranomorante

Hi. Why are we looking for item.title on this line (see image) when the shape of GlobalContext.openNoteMap doesn't have item.title as its property?

is this an issue

I tested adding the full note path instead of just item.title and this issue (overriding notes with the same name) was fixed for me.

...
    GlobalContext.openNoteMap.get(<... the full note path>)
...

I'm still familiarizing with the source code of this project so I cannot really say if this is intentional.

serranomorante avatar Nov 01 '22 04:11 serranomorante

Hi. Why are we looking for item.title on this line (see image) when the shape of GlobalContext.openNoteMap doesn't have item.title as its property?

is this an issue

I tested adding the full note path instead of just item.title and this issue (overriding notes with the same name) was fixed for me.

...
    GlobalContext.openNoteMap.get(<... the full note path>)
...

I'm still familiarizing with the source code of this project so I cannot really say if this is intentional.

Sorry, this looks like a bug, would you like to make a simple PR?

rxliuli avatar Nov 01 '22 05:11 rxliuli

Hi. Why are we looking for item.title on this line (see image) when the shape of GlobalContext.openNoteMap doesn't have item.title as its property? is this an issue I tested adding the full note path instead of just item.title and this issue (overriding notes with the same name) was fixed for me.

...
    GlobalContext.openNoteMap.get(<... the full note path>)
...

I'm still familiarizing with the source code of this project so I cannot really say if this is intentional.

Sorry, this looks like a bug, would you like to make a simple PR?

Of course, I would! I don't even know how to do it, but I would look into it.

If you can guide me somehow in the process it would be very appreciate! 👍👍

Thanks!

serranomorante avatar Nov 01 '22 05:11 serranomorante

Of course, I would! I don't even know how to do it, but I would look into it.

If you can guide me somehow in the process it would be very appreciate! 👍👍

Thanks!

Simply put, it is to first calculate a tempNotePath, and then determine whether it already exists, if so, add the item.id to recalculate

rxliuli avatar Nov 01 '22 05:11 rxliuli

Of course, I would! I don't even know how to do it, but I would look into it. If you can guide me somehow in the process it would be very appreciate! 👍👍 Thanks!

Simply put, it is to first calculate a tempNotePath, and then determine whether it already exists, if so, add the item.id to recalculate

Jajaja thanks but I was talking about the PR! I would look a tutorial on how to do it.

Thanks!

serranomorante avatar Nov 01 '22 05:11 serranomorante