Simultaneously editing and synchronizing files between two devices may lead to accidental data loss. #9

Open
opened 2025-04-16 14:19:55 +00:00 by wenbocn · 3 comments

image
image

  1. Both devices have Siyuan Note installed and are synchronized via WebDAV.
  2. On Device 1, create and edit a new js-draw file. Click save, but do not close the editing tab, then synchronize the changes to the cloud.
  3. On Device 2, pull the synchronized data from the cloud, open the SVG file, edit it, and synchronize the changes back to the cloud.
  4. Continuing to edit the same js-draw file in the originally open tab on Device 1 and attempting to save will result in an error as shown in the image, leading to data loss.
  5. It is hoped that data can be recovered in case of issues, preventing any potential data loss.

Thank you!

![image](/attachments/4bd029fd-df1c-4fca-90f8-464b275a348f) ![image](/attachments/78792c2f-1d73-4c4c-92a1-bf7b0121ba66) 1. Both devices have Siyuan Note installed and are synchronized via WebDAV. 2. On Device 1, create and edit a new js-draw file. Click save, but do not close the editing tab, then synchronize the changes to the cloud. 3. On Device 2, pull the synchronized data from the cloud, open the SVG file, edit it, and synchronize the changes back to the cloud. 4. Continuing to edit the same js-draw file in the originally open tab on Device 1 and attempting to save will result in an error as shown in the image, leading to data loss. 5. It is hoped that data can be recovered in case of issues, preventing any potential data loss. Thank you!
Author

In case of such an error, could the current SVG file be copied to the clipboard, enabling users to perform the paste and save operation themselves?

In case of such an error, could the current SVG file be copied to the clipboard, enabling users to perform the paste and save operation themselves?
Owner

I'm not sure why I didn't think of putting the SVG into the clipboard myself :') It seems like such an obvious choice to make recovering from the error easier...

Anyways, thanks for the report! I was already planning on a change that would fix this issue (and a couple more), I will implement it soon.

I'm not sure why I didn't think of putting the SVG into the clipboard myself :') It seems like such an obvious choice to make recovering from the error easier... Anyways, thanks for the report! I was already planning on a change that would fix this issue (and a couple more), I will implement it soon.
Owner

This has been partially addressed in v0.3.0.
It's already live on the store, so you can test it out and tell me how it goes.

Personally, I've found that the sync is still flaky when editing on a desktop and mobile simultaneously, and it's easy to get sync conflicts to pop up. Unfortunately, that has more to do with the inner workings of SiYuan's sync system than with this plugin, for this reason I recommend enabling "Generate conflict documentation when syncing conflicts", and closing the editor tab on device 1 when editing on device 2, and vice versa.

It seems to me like sometimes SiYuan doesn't do a Refresh when it's supposed to. Normally, I see that when I edit a document on device 1, and then I sync it on device 1 then 2, the app doesn't reload on device 2. I think it's supposed to, but it doesn't. This causes some issues because, if the app isn't reloaded, the js-draw tab still remembers the old state of the drawing.

Remember that in some cases, conflicts are the intended outcome. If you edit the same file differently on two devices at the same time, then sync, they will generate a conflict, and that's normal.

I know that this system is not ideal, but it's hard to come up with an alternative. I will keep this issue open for anyone that wants to add to the conversation.

This has been partially addressed in [v0.3.0](https://git.massive.box/massivebox/siyuan-jsdraw-plugin/releases/tag/v0.3.0). It's already live on the store, so you can test it out and tell me how it goes. Personally, I've found that the sync is still flaky when editing on a desktop and mobile simultaneously, and it's easy to get sync conflicts to pop up. Unfortunately, that has more to do with the inner workings of SiYuan's sync system than with this plugin, for this reason I recommend enabling "Generate conflict documentation when syncing conflicts", and closing the editor tab on device 1 when editing on device 2, and vice versa. It seems to me like sometimes SiYuan doesn't do a Refresh when it's supposed to. Normally, I see that when I edit a document on device 1, and then I sync it on device 1 then 2, the app doesn't reload on device 2. I think it's supposed to, but it doesn't. This causes some issues because, if the app isn't reloaded, the js-draw tab still remembers the old state of the drawing. Remember that in some cases, conflicts are the intended outcome. If you edit the same file differently on two devices at the same time, then sync, they will generate a conflict, and that's normal. I know that this system is not ideal, but it's hard to come up with an alternative. I will keep this issue open for anyone that wants to add to the conversation.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: massivebox/siyuan-jsdraw-plugin#9
No description provided.