Skip to content

Commit 34a0d00

Browse files
authored
fix(payload-cloud): infinite recursion on init (#10467)
1 parent a78bc6c commit 34a0d00

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/payload-cloud/src/plugin.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ export const payloadCloudPlugin =
128128
return config
129129
}
130130

131+
const oldAutoRunCopy = config.jobs.autoRun
132+
131133
const newAutoRun = async (payload: Payload) => {
132134
const instance = generateRandomString()
133135

@@ -150,9 +152,8 @@ export const payloadCloudPlugin =
150152
if (!config.jobs?.autoRun) {
151153
return [DEFAULT_CRON_JOB]
152154
}
153-
return typeof config.jobs.autoRun === 'function'
154-
? await config.jobs.autoRun(payload)
155-
: config.jobs.autoRun
155+
156+
return typeof oldAutoRunCopy === 'function' ? await oldAutoRunCopy(payload) : oldAutoRunCopy
156157
}
157158

158159
config.jobs.autoRun = newAutoRun

0 commit comments

Comments
 (0)