ReactMarkupClient.js — react Source File
Architecture documentation for ReactMarkupClient.js, a javascript file in the react codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR b3169249_4df8_259a_f851_d822bacda746["ReactMarkupClient.js"] a04f08e8_5cb1_4cbd_7655_9850c142d8d8["ReactFizzConfigMarkup.js"] b3169249_4df8_259a_f851_d822bacda746 --> a04f08e8_5cb1_4cbd_7655_9850c142d8d8 d8f20c67_f5fa_0f0a_c967_c41fd9ffce07["ReactTypes"] b3169249_4df8_259a_f851_d822bacda746 --> d8f20c67_f5fa_0f0a_c967_c41fd9ffce07 ca40cfc0_4531_f3fa_7600_53b0400a208c["ReactFizzServer"] b3169249_4df8_259a_f851_d822bacda746 --> ca40cfc0_4531_f3fa_7600_53b0400a208c 0b5d77d6_fa00_515b_1198_0f2d2642dc21["ReactVersion"] b3169249_4df8_259a_f851_d822bacda746 --> 0b5d77d6_fa00_515b_1198_0f2d2642dc21 style b3169249_4df8_259a_f851_d822bacda746 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import type {ReactNodeList} from 'shared/ReactTypes';
import type {ErrorInfo} from 'react-server/src/ReactFizzServer';
import ReactVersion from 'shared/ReactVersion';
import {
createRequest as createFizzRequest,
startWork as startFizzWork,
startFlowing as startFizzFlowing,
abort as abortFizz,
} from 'react-server/src/ReactFizzServer';
import {
createResumableState,
createRenderState,
createRootFormatContext,
} from './ReactFizzConfigMarkup';
type MarkupOptions = {
identifierPrefix?: string,
signal?: AbortSignal,
onError?: (error: mixed, errorInfo: ErrorInfo) => ?string,
};
export function experimental_renderToHTML(
children: ReactNodeList,
options?: MarkupOptions,
): Promise<string> {
return new Promise((resolve, reject) => {
let buffer = '';
const fizzDestination = {
push(chunk: string | null): boolean {
if (chunk !== null) {
buffer += chunk;
} else {
// null indicates that we finished
resolve(buffer);
}
return true;
},
destroy(error: mixed) {
reject(error);
},
};
function handleError(error: mixed, errorInfo: ErrorInfo) {
// Any error rejects the promise, regardless of where it happened.
// Unlike other React SSR we don't want to put Suspense boundaries into
// client rendering mode because there's no client rendering here.
reject(error);
const onError = options && options.onError;
if (onError) {
onError(error, errorInfo);
}
}
const resumableState = createResumableState(
options ? options.identifierPrefix : undefined,
undefined,
);
const fizzRequest = createFizzRequest(
children,
resumableState,
createRenderState(
resumableState,
undefined,
undefined,
undefined,
undefined,
undefined,
),
createRootFormatContext(),
Infinity,
handleError,
undefined,
undefined,
undefined,
undefined,
undefined,
);
if (options && options.signal) {
const signal = options.signal;
if (signal.aborted) {
abortFizz(fizzRequest, (signal: any).reason);
} else {
const listener = () => {
abortFizz(fizzRequest, (signal: any).reason);
signal.removeEventListener('abort', listener);
};
signal.addEventListener('abort', listener);
}
}
startFizzWork(fizzRequest);
startFizzFlowing(fizzRequest, fizzDestination);
});
}
export {ReactVersion as version};
Domain
Dependencies
- ReactFizzConfigMarkup.js
- ReactFizzServer
- ReactTypes
- ReactVersion
Source
Frequently Asked Questions
What does ReactMarkupClient.js do?
ReactMarkupClient.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What does ReactMarkupClient.js depend on?
ReactMarkupClient.js imports 4 module(s): ReactFizzConfigMarkup.js, ReactFizzServer, ReactTypes, ReactVersion.
Where is ReactMarkupClient.js in the architecture?
ReactMarkupClient.js is located at packages/react-markup/src/ReactMarkupClient.js (domain: BabelCompiler, directory: packages/react-markup/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free