payload icon indicating copy to clipboard operation
payload copied to clipboard

Document lock duration doesn't work

Open stofolus opened this issue 2 years ago • 4 comments

Describe the Bug

If user 1 opens and starts editing a collection item and then closes the window. Other users will get an "Document Locked" modal forever (unless they take over) even if there is a duration set

Link to the code that reproduces this issue

Payload template

Reproduction Steps

Create a new page using the website template. Add locking to the pages collection

lockDocuments: {
    duration: 60,
  },

And remove autosave but keep drafts

 versions: {
    drafts: true,
    maxPerDoc: 50,
  },

Then seed the database. Make sure you have at least 2 users. Open a page, make a change without saving and then close the window. The database should now contain one locked document.

After 60 seconds open that document using another user. You will still get a warning. And also an "Edited since" date that is wrong. It's always right now instead of the "updatedAt" date from the payload-locked-documents item.

I've attached a screenshot where 15 minutes have elapsed but I'm still getting the warning Image

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

Not sure

Environment Info

Binaries: Node: 20.17.0 npm: 10.8.2 Yarn: N/A pnpm: 9.0.2 Relevant Packages: payload: 3.0.0-beta.116 next: 15.0.0-canary.173 @payloadcms/db-mongodb: 3.0.0-beta.116 @payloadcms/email-nodemailer: 3.0.0-beta.116 @payloadcms/graphql: 3.0.0-beta.116 @payloadcms/live-preview: 3.0.0-beta.116 @payloadcms/live-preview-react: 3.0.0-beta.116 @payloadcms/next/utilities: 3.0.0-beta.116 @payloadcms/plugin-cloud: 3.0.0-beta.116 @payloadcms/plugin-form-builder: 3.0.0-beta.116 @payloadcms/plugin-nested-docs: 3.0.0-beta.116 @payloadcms/plugin-redirects: 3.0.0-beta.116 @payloadcms/plugin-search: 3.0.0-beta.116 @payloadcms/plugin-seo: 3.0.0-beta.116 @payloadcms/richtext-lexical: 3.0.0-beta.116 @payloadcms/translations: 3.0.0-beta.116 @payloadcms/ui/shared: 3.0.0-beta.116 react: 19.0.0-rc-3edc000d-20240926 react-dom: 19.0.0-rc-3edc000d-20240926 Operating System: Platform: linux Arch: x64 Version: #1 SMP Fri Mar 29 23:14:13 UTC 2024 Available memory (MB): 15970 Available CPU cores: 12

stofolus avatar Oct 18 '24 07:10 stofolus

Hey @stofolus - thanks for bringing this to our attention!

I have a PR for this linked above - adding some tests right now and then we'll get this fix merged up asap.

PatrikKozak avatar Oct 28 '24 17:10 PatrikKozak

🚀 This is included in version v3.0.0-beta.120

github-actions[bot] avatar Oct 29 '24 02:10 github-actions[bot]

Fixed with PRs:

  • #8899
  • #8914

PatrikKozak avatar Oct 29 '24 13:10 PatrikKozak

This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.

github-actions[bot] avatar Oct 31 '24 04:10 github-actions[bot]