File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
packages/payload/src/utilities Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -18,17 +18,23 @@ type Args = {
1818 params ?: {
1919 collection : string
2020 }
21+ payloadInstanceCacheKey ?: string
2122 request : Request
2223}
2324
2425export const createPayloadRequest = async ( {
2526 canSetHeaders,
2627 config : configPromise ,
2728 params,
29+ payloadInstanceCacheKey,
2830 request,
2931} : Args ) : Promise < PayloadRequest > => {
3032 const cookies = parseCookies ( request . headers )
31- const payload = await getPayload ( { config : configPromise , cron : true } )
33+ const payload = await getPayload ( {
34+ config : configPromise ,
35+ cron : true ,
36+ key : payloadInstanceCacheKey ,
37+ } )
3238
3339 const { config } = payload
3440 const localization = config . localization
Original file line number Diff line number Diff line change @@ -63,12 +63,14 @@ export const handleEndpoints = async ({
6363 basePath = '' ,
6464 config : incomingConfig ,
6565 path,
66+ payloadInstanceCacheKey,
6667 request,
6768} : {
6869 basePath ?: string
6970 config : Promise < SanitizedConfig > | SanitizedConfig
7071 /** Override path from the request */
7172 path ?: string
73+ payloadInstanceCacheKey ?: string
7274 request : Request
7375} ) : Promise < Response > => {
7476 let handler ! : PayloadHandler
@@ -122,14 +124,20 @@ export const handleEndpoints = async ({
122124 basePath,
123125 config : incomingConfig ,
124126 path,
127+ payloadInstanceCacheKey,
125128 request : req ,
126129 } )
127130
128131 return response
129132 }
130133
131134 try {
132- req = await createPayloadRequest ( { canSetHeaders : true , config : incomingConfig , request } )
135+ req = await createPayloadRequest ( {
136+ canSetHeaders : true ,
137+ config : incomingConfig ,
138+ payloadInstanceCacheKey,
139+ request,
140+ } )
133141
134142 if ( req . method ?. toLowerCase ( ) === 'options' ) {
135143 return Response . json (
You can’t perform that action at this time.
0 commit comments