Skip to content

Commit 76e4402

Browse files
authored
docs: explicit payload usage from req to avoid import payload confusion (#10291)
1 parent f3f36d8 commit 76e4402

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/hooks/context.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ const Customer: CollectionConfig = {
7272
slug: 'customers',
7373
hooks: {
7474
afterChange: [
75-
async ({ doc }) => {
76-
await payload.update({
75+
async ({ doc, req }) => {
76+
await req.payload.update({
7777
// DANGER: updating the same slug as the collection in an afterChange will create an infinite loop!
7878
collection: 'customers',
7979
id: doc.id,
@@ -101,12 +101,12 @@ const MyCollection: CollectionConfig = {
101101
slug: 'slug',
102102
hooks: {
103103
afterChange: [
104-
async ({ context, doc }) => {
104+
async ({ context, doc, req }) => {
105105
// return if flag was previously set
106106
if (context.triggerAfterChange === false) {
107107
return
108108
}
109-
await payload.update({
109+
await req.payload.update({
110110
collection: contextHooksSlug,
111111
id: doc.id,
112112
data: {

0 commit comments

Comments
 (0)