chore: threads through req so transactions are able to function accordingly

This commit is contained in:
James
2023-09-27 16:52:20 -04:00
parent a73625edb9
commit 5be49e1484
3 changed files with 5 additions and 0 deletions

View File

@@ -64,6 +64,7 @@ async function deleteLocal<TSlug extends keyof GeneratedTypes['collections']>(
fallbackLocale = null,
locale = null,
overrideAccess = true,
req: incomingReq,
showHiddenFields,
user,
where,
@@ -86,6 +87,7 @@ async function deleteLocal<TSlug extends keyof GeneratedTypes['collections']>(
locale: locale ?? defaultLocale,
payload,
payloadAPI: 'local',
transactionID: incomingReq.transactionID,
user,
} as PayloadRequest
setRequestContext(req, context)

View File

@@ -80,6 +80,7 @@ async function updateLocal<TSlug extends keyof GeneratedTypes['collections']>(
locale = null,
overrideAccess = true,
overwriteExistingFiles = false,
req: incomingReq,
showHiddenFields,
user,
where,
@@ -106,6 +107,7 @@ async function updateLocal<TSlug extends keyof GeneratedTypes['collections']>(
locale: locale ?? defaultLocale,
payload,
payloadAPI: 'local',
transactionID: incomingReq?.transactionID,
user,
} as PayloadRequest
setRequestContext(req, context)

View File

@@ -56,6 +56,7 @@ const ContextHooks: CollectionConfig = {
data: {
value: context.secretValue ?? '',
},
req,
context: {
triggerAfterChange: false, // Make sure we don't trigger afterChange again and again in an infinite loop. This should be done via context and not a potential disableHooks property, as we want to specifically test the context functionality here
},