Skip to content

Commit

Permalink
Enable hooks globally when the flag is on
Browse files Browse the repository at this point in the history
This is a DEV only feature.
  • Loading branch information
sebmarkbage committed Dec 15, 2023
1 parent 6f88968 commit 9a963d8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/react-server/src/ReactFlightServerConfigDebugNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,23 @@
*/

import {createAsyncHook} from './ReactFlightServerConfig';
import {enableAsyncDebugInfo} from 'shared/ReactFeatureFlags';

if (__DEV__ && enableAsyncDebugInfo) {
// Initialize the tracing of async operations.
// We do this globally since the async work can potentially eagerly
// start before the first request and once requests start they can interleave.
// In theory we could enable and disable using a ref count of active requests
// but given that typically this is just a live server, it doesn't really matter.
createAsyncHook({
init(asyncId: number, type: string, triggerAsyncId: number): void {
// TODO
},
promiseResolve(asyncId: number): void {
// TODO
},
destroy(asyncId: number): void {
// TODO
},
}).enable();
}

0 comments on commit 9a963d8

Please sign in to comment.