Skip to content

Commit 9a963d8

Browse files
committed
Enable hooks globally when the flag is on
This is a DEV only feature.
1 parent 6f88968 commit 9a963d8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

packages/react-server/src/ReactFlightServerConfigDebugNode.js

+20
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,23 @@
88
*/
99

1010
import {createAsyncHook} from './ReactFlightServerConfig';
11+
import {enableAsyncDebugInfo} from 'shared/ReactFeatureFlags';
12+
13+
if (__DEV__ && enableAsyncDebugInfo) {
14+
// Initialize the tracing of async operations.
15+
// We do this globally since the async work can potentially eagerly
16+
// start before the first request and once requests start they can interleave.
17+
// In theory we could enable and disable using a ref count of active requests
18+
// but given that typically this is just a live server, it doesn't really matter.
19+
createAsyncHook({
20+
init(asyncId: number, type: string, triggerAsyncId: number): void {
21+
// TODO
22+
},
23+
promiseResolve(asyncId: number): void {
24+
// TODO
25+
},
26+
destroy(asyncId: number): void {
27+
// TODO
28+
},
29+
}).enable();
30+
}

0 commit comments

Comments
 (0)