Skip to content

Commit 6930aaf

Browse files
r1tsuudenolfe
authored andcommitted
fix: disable lockedDocuments if the kv adapter uses a collection (#14453)
Fixes #14452 * Adds `collection.lockDocuments: false` to the KV storage collection if the adapter has one. * Filters `relationTo` for the locked documents collection with removing collections that have `lockDocuments: false` in their config.
1 parent d401424 commit 6930aaf

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

packages/payload/src/kv/adapters/DatabaseKVAdapter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ export const databaseKVAdapter = (options: DatabaseKVAdapterOptions = {}): KVAda
122122
required: true,
123123
},
124124
],
125+
lockDocuments: false,
125126
timestamps: false,
126127
...options.kvCollectionOverrides,
127128
},

packages/payload/src/locked-documents/config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ export const getLockedDocumentsCollection = (config: Config): CollectionConfig =
2222
type: 'relationship',
2323
index: true,
2424
maxDepth: 0,
25-
relationTo: [...config.collections!.map((collectionConfig) => collectionConfig.slug)],
25+
relationTo: [
26+
...config
27+
.collections!.filter((collectionConfig) => collectionConfig.lockDocuments !== false)
28+
.map((collectionConfig) => collectionConfig.slug),
29+
],
2630
},
2731
{
2832
name: 'globalSlug',

0 commit comments

Comments
 (0)