jgraph / drawio-desktop

Official electron build of draw.io
https://www.diagrams.net
Apache License 2.0
47.82k stars 4.82k forks source link

Unexpected "Unsaved Changes" often appear on opening #1473

Closed kgscientificReadOnly closed 6 months ago

kgscientificReadOnly commented 1 year ago

Preflight Checklist

Describe the bug Using v21.1.2 on Windows 10 (also seen in earlier application versions), opening up a .drawio file results in an "Unsaved Changes" popup. However no changes have been made. It seems as if a .drawio.dtmp file gets left behind on exit, despite no unsaved changes existing.

To Reproduce There seems to be no obvious cause for this, it seems to happen roughly 50% of the time on opening a file. The file is saved to a local drive (that's backed up to Google Drive).

Expected behavior If no unsaved changes exist, the "Unsaved Changes" popup should not appear.

draw.io version (In the Help->About menu of the draw.io editor):

Desktop (please complete the following information):

Additional context Performing a diff between the .drawio and the .drawio.dtmp, only the first line has differences:

 .drawio:
<mxfile host="Electron" modified="2023-04-04T16:39:26.316Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/21.1.2 Chrome/106.0.5249.199 Electron/21.4.3 Safari/537.36" etag="lpaFChJrVhh1gKMAjnP1" version="21.1.2" type="device" pages="2">
.drawio.dtmp:
<mxfile host="Electron" modified="2023-04-04T16:39:30.416Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/21.1.2 Chrome/106.0.5249.199 Electron/21.4.3 Safari/537.36" etag="bkc0WToFAiR4kEjK_6jY" version="21.1.2" type="device" pages="2">

The two differences being:

GregoryFrederick commented 1 year ago

I, too, experience this on a regular basis. I use the desktop app version on Windows 11, and every time I open a file it shows "Unsaved Changes" even though I definitely saved/exited previously.

wan-nie commented 11 months ago

Same experience. it is very weird. I am very confused and don't know whether to choose 'edit' or 'discard'.

davidjgraph commented 11 months ago

drawio desktop versions? Are you saving to a folder that is a synced cloud storage folder?

wan-nie commented 11 months ago

I'm using a desktop version. When I deleted the related 'drawio.bkp' file, the popup disappeared. It seems the 'drawio.dtmp' file also causes the popup. diff main.drawio '.$main.drawio.dtmp' shows the following.

1c1
< <mxfile host="Electron" modified="2023-07-19T11:58:56.096Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/21.2.8 Chrome/112.0.5615.165 Electron/24.2.0 Safari/537.36" etag="HqiLH4NB1T2rPboJlw8S" version="21.2.8" type="device">
---
> <mxfile host="Electron" modified="2023-07-19T11:58:59.848Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/21.2.8 Chrome/112.0.5615.165 Electron/24.2.0 Safari/537.36" etag="kDf298zBqprlhKL9ZK_u" version="21.2.8" type="device">
davidjgraph commented 11 months ago

21.2.8 isn't the latest version, please use the latest desktop build.

GregoryFrederick commented 11 months ago

@davidjgraph - Yes, I'm saving to Google Drive. Is the asynchronous storage location the issue?

davidjgraph commented 11 months ago

What version of draw.io?

GregoryFrederick commented 11 months ago

@davidjgraph - 20.8.16. I haven't used it in a while. Should this be fixed in a more recent build?

GregKGS commented 11 months ago

Can't speak for @GregoryFrederick , but I've been upgrading drawio since raising this ticket and can confirm I am still seeing it on on v21.6.1.

Likewise, I'm saving to Google Drive.

I've just tried recreating the issue, here's what I've found:

If I open a file, edit it, save it and quickly exit (as fast as I can), the problem doesn't seem to happen 👍 If I open a file, edit it, save it and pause for 10 seconds before exiting, then the problem occurs. 👎

(I've only tried this a couple of times, so can't confirm this is 100% the case.)

Hope this helps!

davidjgraph commented 11 months ago

Thanks @GregKGS that's useful to have something precise to test.

larsch commented 10 months ago

I also experience this very frequently (nearly 100% after working on a diagram and reopening later). I save drawings to OneDrive. What is worse, it's often an older version of the diagram than the one I saved.

Haven't found out what triggers it. When I try to draw, save, close and reopening, it basically never happens. But when open draw.io to work on documents from yesterday, it nearly always does this.

mickyp commented 9 months ago

The issue is still there in Windows desktop version 22.0.0. Either installer or no-installer will cause this problem.

Every time I need to delete bkp and dtmp files manually.

GerMUC commented 8 months ago

I confirm the same issue with v22.0.2 - using OneDrive.

JeroenOortwijn commented 7 months ago

Duplicate of #1127

m-mohamedin commented 6 months ago

Should be fixed in v22.1.16