Having note open across suspends or internet connection loss led to unsaved data
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.
AFAIK its a known issue, talk to @LukasReschke
Session or tokens seem to time out although a heartbeat is present
I think there are two posibilities:
- Provide/fix long-lasting sessions by the server (other apps can benefit from this, too)
- Implement some kind of offline mode in the notes app (we had a discussion about this already, see #11)
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.
That would be nice. Is there anyone who want to implement this?
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.
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:
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.
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.
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? 😉
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.