@@ -9,6 +9,7 @@ import { InternalEvent, InternalResult } from "types/open-next";
9
9
import { DetachedPromiseRunner } from "utils/promise" ;
10
10
11
11
import { debug , error , warn } from "../adapters/logger" ;
12
+ import { patchAsyncStorage } from "./patchAsyncStorage" ;
12
13
import { convertRes , createServerResponse , proxyRequest } from "./routing/util" ;
13
14
import routingHandler , { MiddlewareOutputEvent } from "./routingHandler" ;
14
15
import { requestHandler , setNextjsPrebundledReact } from "./util" ;
@@ -17,8 +18,11 @@ import { requestHandler, setNextjsPrebundledReact } from "./util";
17
18
globalThis . __als = new AsyncLocalStorage < {
18
19
requestId : string ;
19
20
pendingPromiseRunner : DetachedPromiseRunner ;
21
+ isISRRevalidation ?: boolean ;
20
22
} > ( ) ;
21
23
24
+ patchAsyncStorage ( ) ;
25
+
22
26
export async function openNextHandler (
23
27
internalEvent : InternalEvent ,
24
28
responseStreaming ?: StreamCreator ,
@@ -98,8 +102,9 @@ export async function openNextHandler(
98
102
const requestId = Math . random ( ) . toString ( 36 ) ;
99
103
const pendingPromiseRunner : DetachedPromiseRunner =
100
104
new DetachedPromiseRunner ( ) ;
105
+ const isISRRevalidation = headers [ "x-isr" ] === "1" ;
101
106
const internalResult = await globalThis . __als . run (
102
- { requestId, pendingPromiseRunner } ,
107
+ { requestId, pendingPromiseRunner, isISRRevalidation } ,
103
108
async ( ) => {
104
109
const preprocessedResult = preprocessResult as MiddlewareOutputEvent ;
105
110
const req = new IncomingMessage ( reqProps ) ;
0 commit comments