Skip to content

Ensure files are saved on close #3899

Description

@max-nextcloud

Describe the bug
Sometimes closing the editor won't save the file.
The sync request goes out but since the version has not increased it does not save anything.

To Reproduce
Steps to reproduce the behavior:

  1. Open file in text
  2. Type something and click x to close viewer directly after
  3. Download the file
  4. Sometimes observe last edits missing

Expected behavior
Closing the viewer should always save the file

Will provide logs once i recorded them.

Background

When typing the changes are send out via the push endpoint.
However the version counter will only increment once a sync request happened.
In the meantime save requests will still have the same version and be ignored.

Possible solutions

Increment version on push

We could increase the version whenever we push - but this would require including all intermediate changes by others in the answer to the push request. The version counter is mainly used to not fetch steps over and over again - so we cannot just increase it as that would lead to ignoring relevant steps.

Sync before saving

We could also use two requests for saving - one to ensure the current version is up to date and then one to actually save the file.

Activity

  1. added this to the Nextcloud 26 milestone on Mar 6, 2023
  2. max-nextcloud commented on Mar 6, 2023

    @max-nextcloud
    CollaboratorAuthor

    Sync before saving is what we did in the past and i think it's the least intrusive and easiest change - even though it will require another roundtrip.

  3. moved this to 🧭 Planning evaluation (don't pick) in 📝 Productivity teamon Mar 22, 2023
  4. 6 remaining items

  5. removed this from the Nextcloud 26.0.4 milestone on Jun 29, 2023
  6. moved this from 🧭 Planning evaluation (don't pick) to 🏗️ In progress in 📝 Productivity teamon Jul 10, 2023
  7. DavidMikeSimon commented on Sep 29, 2023

    @DavidMikeSimon

    @blizzz I'm also still noticing this behavior. It's especially troublesome because re-opening the file and clicking the save icon has no effect. The user must first make some other change to the file before clicking the save button, in order for it to actually write anything to disk.

    Apologies if the fix is still in progress, I don't mean to create a rush! 😅

  8. blizzz commented on Oct 6, 2023

    @blizzz
    Member

    @DavidMikeSimon actually i cannot reproduce this behaviour anymore. Do you have some reliable reproduction steps perhaps?

  9. DavidMikeSimon commented on Oct 9, 2023

    @DavidMikeSimon

    @blizzz Here is how I'm able to reproduce it:

    • Outside of NextCloud, create a file foo.txt with contents ABC, in a location that NextCloud can see via an external storage mount.
    • Open file in NextCloud Text. Edit contents to XYZ. Immediately close the file using the X icon, without clicking the checkmark icon.
    • ❗ File on disk has the out-of-date contents ABC.
    • Refresh NextCloud. Open the file in NextCloud Text, where the file appears to contain XYZ. However the file on disk still contains ABC.
    • Click the checkmark icon for the file in NextCloud Text. The file on disk still just contains ABC.

    Nextcloud version: 27.0.2
    Text app version: 3.8.0

  10. max-nextcloud commented on Dec 19, 2023

    @max-nextcloud
    CollaboratorAuthor

    Thanks @DavidMikeSimon.
    I was able to reproduce this. I think there are two issues at play here:

    • Closing the viewer should remove the editor view and save the content - need to investigate what's happening there.
    • We don't save anything if there have not been any changes by the current user - but we should probably only do that when it comes to autosaving - but still save on click.
  11. juliusknorr commented on Feb 20, 2024

    @juliusknorr
    Member

    @blizzz Will unassign you as it looks more like a frontend issue ;)

  12. moved this from 🏗️ In progress to 🧭 Planning evaluation (don't pick) in 📝 Productivity teamon Apr 17, 2024
  13. bentuna commented on Sep 2, 2024

    @bentuna

    Under 28.0.9, we can still reproduce the issue sometimes: When you close a text document without clicking save, a part of your unsaved contents is lost. And: that does not only happen on external storage.

  14. mejo- commented on Apr 27, 2026

    @mejo-
    Member

    This should be solved nowadays. Please report if you still experience this problem.

  15. moved this from 🧭 Planning evaluation (don't pick) to ☑️ Done in 📝 Productivity teamon Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions