From a043ee5619c4b0319e4574ca7738134cde0dd94c Mon Sep 17 00:00:00 2001 From: Patrik Kozak Date: Mon, 4 Nov 2024 09:18:11 -0500 Subject: [PATCH] chore: adds some clarity for better readability of locked-document docs --- docs/admin/locked-documents.mdx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/admin/locked-documents.mdx b/docs/admin/locked-documents.mdx index cca39f892ef..4306649efdc 100644 --- a/docs/admin/locked-documents.mdx +++ b/docs/admin/locked-documents.mdx @@ -2,7 +2,7 @@ title: Document Locking label: Document Locking order: 90 -desc: Ensure your documents are locked while being edited, preventing concurrent edits from multiple users and preserving data integrity. +desc: Ensure your documents are locked during editing to prevent concurrent changes from multiple users and maintain data integrity. keywords: locking, document locking, edit locking, document, concurrency, Payload, headless, Content Management System, cms, javascript, react, node, nextjs --- @@ -12,19 +12,19 @@ The lock is automatically triggered when a user begins editing a document within ## How it works -When a user starts editing a document, Payload locks the document for that user. If another user tries to access the same document, they will be notified that it is currently being edited and can choose one of the following options: +When a user starts editing a document, Payload locks it for that user. If another user attempts to access the same document, they will be notified that it is currently being edited. They can then choose one of the following options: -- View in Read-Only Mode: View the document without making any changes. -- Take Over Editing: Take over editing from the current user, which locks the document for the new editor and notifies the original user. +- View in Read-Only: View the document without the ability to make any changes. +- Take Over: Take over editing from the current user, which locks the document for the new editor and notifies the original user. - Return to Dashboard: Navigate away from the locked document and continue with other tasks. -The lock will automatically expire after a set period of inactivity, configurable using the duration property in the lockDocuments configuration, after which others can resume editing. +The lock will automatically expire after a set period of inactivity, configurable using the `duration` property in the `lockDocuments` configuration, after which others can resume editing. - Note: If your application does not require document locking, you can disable this feature for any collection by setting the lockDocuments property to false. + Note: If your application does not require document locking, you can disable this feature for any collection or global by setting the lockDocuments property to false. ### Config Options -The lockDocuments property exists on both the Collection Config and the Global Config. By default, document locking is enabled for all collections and globals, but you can customize the lock duration or disable the feature entirely. +The `lockDocuments` property exists on both the Collection Config and the Global Config. Document locking is enabled by default, but you can customize the lock duration or turn off the feature for any collection or global. Here’s an example configuration for document locking: @@ -55,13 +55,13 @@ export const Posts: CollectionConfig = { ### Impact on APIs -Document locking affects both the Local API and the REST API, ensuring that if a document is locked, concurrent users will not be able to perform updates or deletes on that document (including globals). If a user attempts to update or delete a locked document, they will receive an error. +Document locking affects both the Local and REST APIs, ensuring that if a document is locked, concurrent users will not be able to perform updates or deletes on that document (including globals). If a user attempts to update or delete a locked document, they will receive an error. Once the document is unlocked or the lock duration has expired, other users can proceed with updates or deletes as normal. #### Overriding Locks -For operations like update and delete, Payload includes an `overrideLock` option. This boolean flag, when set to `false`, enforces document locks, ensuring that the operation will not proceed if another user currently holds the lock. +For operations like `update` and `delete`, Payload includes an `overrideLock` option. This boolean flag, when set to `false`, enforces document locks, ensuring that the operation will not proceed if another user currently holds the lock. By default, `overrideLock` is set to `true`, which means that document locks are ignored, and the operation will proceed even if the document is locked. To enforce locks and prevent updates or deletes on locked documents, set `overrideLock: false`.