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

Function serializeModel

packages/react-client/src/ReactFlightReplyClient.js:861–873  ·  view source on GitHub ↗
(model: ReactServerValue, id: number)

Source from the content-addressed store, hash-verified

859 }
860
861 function serializeModel(model: ReactServerValue, id: number): string {
862 if (typeof model === 'object' && model !== null) {
863 const reference = serializeByValueID(id);
864 writtenObjects.set(model, reference);
865 if (temporaryReferences !== undefined) {
866 // Store this object so that the server can refer to it later in responses.
867 writeTemporaryReference(temporaryReferences, reference, model);
868 }
869 }
870 modelRoot = model;
871 // $FlowFixMe[incompatible-return] it's not going to be undefined because we'll encode it.
872 return JSON.stringify(model, resolveToJSON);
873 }
874
875 function abort(reason: mixed): void {
876 if (pendingParts > 0) {

Callers 3

resolveToJSONFunction · 0.85
retryFunction · 0.85
processReplyFunction · 0.85

Calls 3

writeTemporaryReferenceFunction · 0.90
setMethod · 0.80
serializeByValueIDFunction · 0.70

Tested by

no test coverage detected