nextcloud / notes

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

NC26 Browser Popup when leaving Notes App whitin a note #987

Closed apg1980 closed 1 year ago

apg1980 commented 1 year ago

Please make a clear and concise description of what the bug is. Please note, that issues with the Android app have to be reported under https://github.com/stefan-niedermann/nextcloud-notes/issues and issues with Nextcloud's Text app have to be reported under https://github.com/nextcloud/text/issues .

Steps to reproduce

1.open notes and write a note

  1. click on files app or another
  2. browser popup appears whit hint unsafed data gets lost

Expected behaviour

Data is safed

Actual behaviour

Tell us what happens instead grafik

Screenshots

If applicable, add screenshots to help explain your problem.

Server

Please complete the following information.

Nextcloud configuration:

``` If you have access to your command line run e.g.: sudo -u www-data php occ config:list system from within your Nextcloud installation folder ```

Client

Please complete the following information.

Log files

Add relevant parts of your nextcloud.log and/or your browser's JavaScript console here.

theatischbein commented 1 year ago

I can confirm it with Nextcloud 25 and Notes app 4.7.1 (debain 11, nginx, php 8.2, mysql) I tested both rich text and editor mode

Edit: But I have to be fast enough, otherwise autosave triggers first

Suggestion: It appears to be this section of code. Why not add an commit call here instead of warning the user ? https://github.com/nextcloud/notes/blob/6dca9d77318ed805f4b9d901f75a24394d163462/src/App.vue#L339-L343

juliusknorr commented 1 year ago

This is a browser limitation as it is not guaranteed that any requests performed during the before unload event are handled. This event is explicitly only for asking for confirmation. As far as I'm aware there is no way we can ensure that the file would be saved before navigating away except blocking with this dialog.

apg1980 commented 1 year ago

why did it worked on nc25?

apg1980 commented 1 year ago

furthermore if i just stay on an note it appears while changing the nc site

theatischbein commented 1 year ago

why did it worked on nc25?

What do you mean with "it worked" ?

For me (on nc25 and nc26) it behaves as followed:

In other words (like the code in my comment showed https://github.com/nextcloud/notes/issues/987#issuecomment-1479888547 ): If you leave the app faster than the background asyncronous saving of the note is finished the warning appears to prevent data loss. The latency of automatically saving a note should depend on the servers performance and you network connectivity, If I am not mislead.

apg1980 commented 1 year ago

i did never get an popup on latest nc25 with the latest notes app on realease date of nc26 before upgrading to nc26. this behaviour is new, the environment (server nginx etc did not changed)

juliusknorr commented 1 year ago

Do you use the plain markdown or the rich editing view? For the plain markdown the logic shouldn't have changed at all from 25.

apg1980 commented 1 year ago

same behaviour on both methods. next thin i can see, notes are not getting saved as expected before. you can see the star beneth the note, latest changes are not saved after minutes. i lost some important notes today, after leaving the typed notes.

florianwgnr commented 1 year ago

Relates to #1008 with NC 26