@@ -289,12 +289,9 @@ 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
294293 const lastModified =
295- globalThis . lastModified [ requestId ] > 0
296- ? globalThis . lastModified [ requestId ]
297- : "" ;
294+ globalThis . __openNextAls . getStore ( ) ?. lastModified ?? 0 ;
298295
299296 // For some weird cases, lastModified is not set, haven't been able to figure out yet why
300297 // For those cases we add the etag to the deduplication id, it might help
@@ -321,15 +318,14 @@ export function fixISRHeaders(headers: OutgoingHttpHeaders) {
321318 "private, no-cache, no-store, max-age=0, must-revalidate" ;
322319 return ;
323320 }
324- const requestId = globalThis . __openNextAls . getStore ( ) ?. requestId ?? "" ;
325- const _lastModified = globalThis . lastModified [ requestId ] ?? 0 ;
321+ const _lastModified = globalThis . __openNextAls . getStore ( ) ?. lastModified ?? 0 ;
326322 if ( headers [ CommonHeaders . NEXT_CACHE ] === "HIT" && _lastModified > 0 ) {
327323 // calculate age
328324 const age = Math . round ( ( Date . now ( ) - _lastModified ) / 1000 ) ;
329325 // extract s-maxage from cache-control
330326 const regex = / s - m a x a g e = ( \d + ) / ;
331327 const cacheControl = headers [ CommonHeaders . CACHE_CONTROL ] ;
332- debug ( "cache-control" , cacheControl , globalThis . lastModified , Date . now ( ) ) ;
328+ debug ( "cache-control" , cacheControl , _lastModified , Date . now ( ) ) ;
333329 if ( typeof cacheControl !== "string" ) return ;
334330 const match = cacheControl . match ( regex ) ;
335331 const sMaxAge = match ? Number . parseInt ( match [ 1 ] ) : undefined ;
0 commit comments