Skip to content

Commit

Permalink
clone json obj in relay flight client host config parser
Browse files Browse the repository at this point in the history
  • Loading branch information
lunaruan committed Dec 15, 2020
1 parent 604bbcd commit 3cb8d34
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export {
requireModule,
} from 'ReactFlightDOMRelayClientIntegration';

export type {ModuleMetaData} from 'ReactFlightDOMRelayClientIntegration';
export tyspe {ModuleMetaData} from 'ReactFlightDOMRelayClientIntegration';

export type UninitializedModel = JSONValue;

Expand All @@ -36,18 +36,21 @@ function parseModelRecursively(response: Response, parentObj, value) {
}
if (typeof value === 'object' && value !== null) {
if (Array.isArray(value)) {
const parsedValue = [];
for (let i = 0; i < value.length; i++) {
(value: any)[i] = parseModelRecursively(response, value, value[i]);
(parsedValue: any)[i] = parseModelRecursively(response, value, value[i]);
}
return parseModelTuple(response, value);
return parseModelTuple(response, parsedValue);
} else {
const parsedValue = {};
for (const innerKey in value) {
(value: any)[innerKey] = parseModelRecursively(
(parsedValue: any)[innerKey] = parseModelRecursively(
response,
value,
value[innerKey],
);
}
return parsedValue;
}
}
return value;
Expand Down

0 comments on commit 3cb8d34

Please sign in to comment.