[network[ Fix missing response status code bug
Summary: There's a bug in the network inspector. Messages come in in batches for performance reasons. These batches can include both requests and responses, but the code assumes only one or the other. This fixes it to make it not mutually exclusive. This bug only affects row building in the table, so when you click on the row, you can still see the response and everything. Reviewed By: cekkaewnumchai Differential Revision: D23102575 fbshipit-source-id: 47e8c6b0f1c9cf0d5860b6f349a7d9fe225c73ae
This commit is contained in:
committed by
Facebook GitHub Bot
parent
d423afd75d
commit
f743940d02
@@ -694,20 +694,25 @@ function calculateState(
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (props.responses !== nextProps.responses) {
|
||||
}
|
||||
if (props.responses !== nextProps.responses) {
|
||||
// new or updated response
|
||||
const resId = Object.keys(nextProps.responses).find(
|
||||
const resIds = Object.keys(nextProps.responses).filter(
|
||||
(responseId: RequestId) =>
|
||||
props.responses[responseId] !== nextProps.responses[responseId],
|
||||
);
|
||||
if (resId) {
|
||||
const request = nextProps.requests[resId];
|
||||
// sanity check; to pass null check
|
||||
if (request) {
|
||||
const newRow = buildRow(request, nextProps.responses[resId]);
|
||||
const index = rows.findIndex((r: TableBodyRow) => r.key === request.id);
|
||||
if (index > -1 && newRow) {
|
||||
rows[index] = newRow;
|
||||
for (const resId of resIds) {
|
||||
if (resId) {
|
||||
const request = nextProps.requests[resId];
|
||||
// sanity check; to pass null check
|
||||
if (request) {
|
||||
const newRow = buildRow(request, nextProps.responses[resId]);
|
||||
const index = rows.findIndex(
|
||||
(r: TableBodyRow) => r.key === request.id,
|
||||
);
|
||||
if (index > -1 && newRow) {
|
||||
rows[index] = newRow;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user