@@ -289,12 +289,10 @@ export async function revalidateIfRequired(
289289 try {
290290 const hash = ( str : string ) =>
291291 crypto . createHash ( "md5" ) . update ( str ) . digest ( "hex" ) ;
292- const requestId = globalThis . __openNextAls . getStore ( ) ?. requestId ?? "" ;
293292
294- const lastModified =
295- globalThis . lastModified [ requestId ] > 0
296- ? globalThis . lastModified [ requestId ]
297- : "" ;
293+ const lastModified = String (
294+ globalThis . __openNextAls . getStore ( ) ?. lastModified ?? "" ,
295+ ) ;
298296
299297 // For some weird cases, lastModified is not set, haven't been able to figure out yet why
300298 // For those cases we add the etag to the deduplication id, it might help
@@ -321,15 +319,14 @@ export function fixISRHeaders(headers: OutgoingHttpHeaders) {
321319 "private, no-cache, no-store, max-age=0, must-revalidate" ;
322320 return ;
323321 }
324- const requestId = globalThis . __openNextAls . getStore ( ) ?. requestId ?? "" ;
325- const _lastModified = globalThis . lastModified [ requestId ] ?? 0 ;
322+ const _lastModified = globalThis . __openNextAls . getStore ( ) ?. lastModified ?? 0 ;
326323 if ( headers [ CommonHeaders . NEXT_CACHE ] === "HIT" && _lastModified > 0 ) {
327324 // calculate age
328325 const age = Math . round ( ( Date . now ( ) - _lastModified ) / 1000 ) ;
329326 // extract s-maxage from cache-control
330327 const regex = / s - m a x a g e = ( \d + ) / ;
331328 const cacheControl = headers [ CommonHeaders . CACHE_CONTROL ] ;
332- debug ( "cache-control" , cacheControl , globalThis . lastModified , Date . now ( ) ) ;
329+ debug ( "cache-control" , cacheControl , _lastModified , Date . now ( ) ) ;
333330 if ( typeof cacheControl !== "string" ) return ;
334331 const match = cacheControl . match ( regex ) ;
335332 const sMaxAge = match ? Number . parseInt ( match [ 1 ] ) : undefined ;
0 commit comments