nextcloud / notes

✎ Distraction-free notes and writing
https://apps.nextcloud.com/apps/notes
GNU Affero General Public License v3.0
623 stars 133 forks source link

Having note open across suspends or internet connection loss led to unsaved data #122

Open jancborchardt opened 7 years ago

jancborchardt commented 7 years ago

I had the notes app open in a tab since yesterday. Today I continued on the same note and finished what I was writing. After encountering the copying issue https://github.com/nextcloud/notes/issues/121 I checked in the Notes folder of Files, and found the note to be last saved 21 hours ago.

After having copied the new text somewhere else, I refreshed the page and the new text was gone. So this is quite a big issue. ;) Maybe we should have a constant heartbeat to the server, or force a reconnection? Not sure if we do something special in the texteditor app here.

cc @nextcloud/notes @nextcloud/javascript

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/47696500-having-note-open-across-suspends-or-internet-connection-loss-led-to-unsaved-data?utm_campaign=plugin&utm_content=tracker%2F46751022&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F46751022&utm_medium=issues&utm_source=github).
BernhardPosselt commented 7 years ago

AFAIK its a known issue, talk to @LukasReschke

Session or tokens seem to time out although a heartbeat is present

korelstar commented 7 years ago

I think there are two posibilities:

  1. Provide/fix long-lasting sessions by the server (other apps can benefit from this, too)
  2. Implement some kind of offline mode in the notes app (we had a discussion about this already, see #11)
BernhardPosselt commented 7 years ago

Solution should be to always store a note backup in localstorage (which could be too small in some cases, indexeddb or ask user to increase storage?) together with its modified time in unix time in milliseconds

If a note update is sent to the server, the server will compare the modified timestamps of the sent one and the one on the disk. Only if the sent timestamp is greater or equal, the note will be updated, otherwise the contents of the note on disk will be returned.

You could ofc also offer a diff and let the user choose which one to keep if the sent timestamp is older than the version on the server.

korelstar commented 7 years ago

That would be nice. Is there anyone who want to implement this?

Vlad-M-1 commented 7 years ago

This issue with data loss on connection problems is quite important. Currently this app is not a safe home for all our data like it's stated on the main page. But I'd like it to be. I'd even crowdfund $70 to get it solved :) For example, I can send them to one of maintainers, and that person could reward someone after solution is approved.

jancborchardt commented 6 years ago

Removed the organizational comments about Bountysource – you can now donate to this issue (and others) at https://www.bountysource.com/issues/47696500-having-note-open-across-suspends-or-internet-connection-loss-led-to-unsaved-data :+1:

korelstar commented 5 years ago

There is a similar issue in the mail app: https://github.com/nextcloud/mail/issues/121 - I think the fix should be equal (currently, it is unfixed for some years).

Just for the protocol: a suggested fix in the server (https://github.com/nextcloud/server/pull/6360) did not improve the situation for this app.

The suggested offline-mode (see https://github.com/nextcloud/notes/issues/122#issuecomment-318640540) would be nice, but it has another goal and should be discussed in another issue. I don't think that we need this to solve the original issue, here.

tnyeanderson commented 5 years ago

I think we should implement a service worker for some kind of offline mode. This would also make it easier to turn this into a PWA, which I was going to suggest in another issue.

juliusknorr commented 1 year ago

If the request after reconnecting failed due to a CSRF token issue this should mostly be addressed now that nextcloud-axios is using the refetched token: https://github.com/nextcloud/nextcloud-axios/blob/master/lib/interceptors/csrf-token.ts

@jancborchardt Do you still see this happening? 😉

mobamoba commented 9 months ago

I see this happening with the most recent update of Notes (4.92). I never had it before but it's happening all the time now.

sunkup commented 1 month ago

Still happening. Notes v4.11.0.

After having the notes editor open for a while (I think 2-3 hours are enough) I can make changes in the document, which are not recognized anymore and lost on page refresh. The little checkmark does not show the "unsaved" dot and the version history is not updated anymore - even when actively clicking the save checkmark - see screenshot.

Screenshot ![image](https://github.com/user-attachments/assets/a4cdf08f-2152-44b9-9d20-3c287c25eb49)