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

Function serializeModel

packages/react-client/src/ReactFlightReplyClient.js:861–873  ·  packages/react-client/src/ReactFlightReplyClient.js::serializeModel
(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 === class="st">'object' && model !== null) {
863 const reference = serializeByValueID(id);
864 writtenObjects.set(model, reference);
865 if (temporaryReferences !== undefined) {
866 class="cm">// 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 class="cm">// $FlowFixMe[incompatible-return] itclass="st">'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