MCPcopy
hub / github.com/facebook/react / emitPostponeChunk

Function emitPostponeChunk

packages/react-server/src/ReactFlightServer.js:4041–4065  ·  view source on GitHub ↗
(
  request: Request,
  id: number,
  postponeInstance: Postpone,
)

Source from the content-addressed store, hash-verified

4039}
4040
4041function emitPostponeChunk(
4042 request: Request,
4043 id: number,
4044 postponeInstance: Postpone,
4045): void {
4046 let row;
4047 if (__DEV__) {
4048 let reason = '';
4049 let stack: ReactStackTrace;
4050 const env = request.environmentName();
4051 try {
4052 // eslint-disable-next-line react-internal/safe-string-coercion
4053 reason = String(postponeInstance.message);
4054 stack = filterStackTrace(request, parseStackTrace(postponeInstance, 0));
4055 } catch (x) {
4056 stack = [];
4057 }
4058 row = serializeRowHeader('P', id) + stringify({reason, stack, env}) + '\n';
4059 } else {
4060 // No reason included in prod.
4061 row = serializeRowHeader('P', id) + '\n';
4062 }
4063 const processedChunk = stringToChunk(row);
4064 request.completedErrorChunks.push(processedChunk);
4065}
4066
4067function serializeErrorValue(request: Request, error: Error): string {
4068 if (__DEV__) {

Callers 3

renderModelFunction · 0.85
erroredTaskFunction · 0.85
abortFunction · 0.85

Calls 6

stringToChunkFunction · 0.90
filterStackTraceFunction · 0.85
serializeRowHeaderFunction · 0.85
stringifyFunction · 0.85
parseStackTraceFunction · 0.70
pushMethod · 0.65

Tested by

no test coverage detected