chore: use updatedAt instead of editedAt for locked documents (#8324)

- Removes locked documents `editedAt` as it was redundant with the
`updatedAt` timestamp
- Adjust stale lock tests to configure the duration down to 1 second and
await it to not lose any test coverage
- DB performance changes: 
1. Switch to payload.db.find instead of payload.find for
checkDocumentLockStatus to avoid populating the user and other payload
find overhead
   2. Add maxDepth: 1 to user relationship
   3. Add index to global slug
This commit is contained in:
Dan Ribbens
2024-09-20 09:08:58 -04:00
committed by GitHub
parent 79c117c664
commit dbdc7d9308
9 changed files with 38 additions and 42 deletions

View File

@@ -193,7 +193,6 @@ const DocumentInfo: React.FC<
// Send a patch request to update the _lastEdited info
await requests.patch(`${serverURL}${api}/payload-locked-documents/${lockId}`, {
body: JSON.stringify({
editedAt: new Date(),
user: { relationTo: user?.collection, value: user?.id },
}),
headers: {

View File

@@ -265,9 +265,7 @@ export const buildFormState = async ({
await req.payload.db.updateOne({
id: lockedDocument.docs[0].id,
collection: 'payload-locked-documents',
data: {
editedAt: new Date().toISOString(),
},
data: {},
req,
})
}
@@ -284,7 +282,6 @@ export const buildFormState = async ({
value: id,
}
: undefined,
editedAt: new Date().toISOString(),
globalSlug: globalSlug ? globalSlug : undefined,
user: {
relationTo: [req.user.collection],