Skip to content

Document locking with multiple editors is not working with Autosave enabled #11604

Closed

Description

@pranavks

Describe the Bug

When Autosave is on, User 1 is able to access and edit the post being edited by User 2, which causes data loss.

From @PatrikKozak in Discord:
"So the way document locking works is once a user saves the document, we unlock the document. Based on the video above, I can see you have autosave enabled. So whenever you start editing, the document will lock but as soon as autosave fires, the document is unlocked."

Link to Discord thread : https://discord.com/channels/967097582721572934/1347546084683022437

Link to the code that reproduces this issue

Website template using Payload v3.27.0

Reproduction Steps

  1. Enable Autosave
  2. Test Document locking with multiple editors

Which area(s) are affected? (Select all that apply)

Not sure

Environment Info

Payload v3.27.0
Nextjs v15.2.0
Node v22.13.0

Activity

  1. added
    status: needs-triagePossible bug which hasn't been reproduced yet
    validate-reproductionAuto-added tag on create to tell bot to check recreation URL, removed after check.
    on Mar 10, 2025
  2. github-actions commented on Mar 10, 2025

    @github-actions
    Contributor

    Please add a reproduction in order for us to be able to investigate.

    Depending on the quality of reproduction steps, this issue may be closed if no reproduction is provided.

    Why was this issue marked with the invalid-reproduction label?

    To be able to investigate, we need access to a reproduction to identify what triggered the issue. We prefer a link to a public GitHub repository created with create-payload-app@latest -t blank or a forked/branched version of this repository with tests added (more info in the reproduction-guide).

    To make sure the issue is resolved as quickly as possible, please make sure that the reproduction is as minimal as possible. This means that you should remove unnecessary code, files, and dependencies that do not contribute to the issue. Ensure your reproduction does not depend on secrets, 3rd party registries, private dependencies, or any other data that cannot be made public. Avoid a reproduction including a whole monorepo (unless relevant to the issue). The easier it is to reproduce the issue, the quicker we can help.

    Please test your reproduction against the latest version of Payload to make sure your issue has not already been fixed.

    I added a link, why was it still marked?

    Ensure the link is pointing to a codebase that is accessible (e.g. not a private repository). "example.com", "n/a", "will add later", etc. are not acceptable links -- we need to see a public codebase. See the above section for accepted links.

    Useful Resources

  3. removed
    validate-reproductionAuto-added tag on create to tell bot to check recreation URL, removed after check.
    on Mar 10, 2025
  4. paulpopus commented on Mar 10, 2025

    @paulpopus
    Member

    Currently this is intended behaviour, document locking is there to prevent somebody editing data while you're still editing but the document is unlocked as soon as you save, which obviously with autosave is almost immediate.

    There's a few things we could do here to enhance this feature, such as providing manual locking controls and automatically locking on a timer for those with autosave.

    I will convert this into a discussion since it's not an actual bug with the functionality

  5. locked and limited conversation to collaborators on Mar 10, 2025
  6. converted this issue into a discussion #11606 on Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions