notes icon indicating copy to clipboard operation
notes copied to clipboard

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

Open jancborchardt opened this issue 7 years ago • 10 comments

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! We accept bounties via Bountysource.

jancborchardt avatar Jul 28 '17 10:07 jancborchardt

AFAIK its a known issue, talk to @LukasReschke

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

BernhardPosselt avatar Jul 28 '17 11:07 BernhardPosselt

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)

korelstar avatar Jul 28 '17 12:07 korelstar

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.

BernhardPosselt avatar Jul 28 '17 12:07 BernhardPosselt

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

korelstar avatar Jul 28 '17 13:07 korelstar

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.

Vlad-M-1 avatar Nov 22 '17 19:11 Vlad-M-1

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:

jancborchardt avatar Jun 05 '18 16:06 jancborchardt

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.

korelstar avatar Jan 06 '19 19:01 korelstar

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.

tnyeanderson avatar Apr 21 '19 03:04 tnyeanderson

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? 😉

juliushaertl avatar Jan 03 '23 16:01 juliushaertl

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.

mobamoba avatar Jan 29 '24 13:01 mobamoba