@@ -100,15 +100,16 @@ const CompressionDescription = observer((p: {
100
100
} ) => {
101
101
const { encodings, encodedBodyLength, decodedBodyLength } = p ;
102
102
103
- const compressionRatio = decodedBodyLength ? Math . round ( 100 * (
104
- 1 - ( encodedBodyLength / decodedBodyLength )
105
- ) ) : undefined ;
103
+ const compressionRatio = decodedBodyLength
104
+ ? Math . round ( 100 * ( 1 - ( encodedBodyLength / decodedBodyLength ) ) )
105
+ : undefined ;
106
106
107
107
return < >
108
108
{ encodings . length ? < >
109
109
compressed with < strong > { joinAnd ( encodings , ', ' , ' and then ' ) } </ strong > ,
110
110
making it {
111
- compressionRatio !== undefined && decodedBodyLength ? < >
111
+ compressionRatio !== undefined && decodedBodyLength
112
+ ? < >
112
113
< strong >
113
114
{ compressionRatio >= 0 ?
114
115
`${ compressionRatio } % smaller`
@@ -120,7 +121,8 @@ const CompressionDescription = observer((p: {
120
121
} to {
121
122
getReadableSize ( encodedBodyLength )
122
123
} )
123
- </ > : < Icon icon = { [ 'fas' , 'spinner' ] } spin />
124
+ </ >
125
+ : < Icon icon = { [ 'fas' , 'spinner' ] } spin />
124
126
}
125
127
</ > :
126
128
< strong > not compressed</ strong >
@@ -213,10 +215,15 @@ const CompressionPerformance = observer((p: { exchange: HttpExchange }) => {
213
215
214
216
return < > { messageTypes . map ( ( messageType ) => {
215
217
const message = p . exchange [ messageType ] ;
216
- const encodings = getEncodings ( message ) ;
217
218
218
- if ( typeof message !== 'object' || ! message . body . encodedByteLength ) return null ;
219
+ if (
220
+ typeof message !== 'object' ||
221
+ ! message ?. body ||
222
+ ! message . body . encodedByteLength ||
223
+ message . body . isFailed ( )
224
+ ) return null ;
219
225
226
+ const encodings = getEncodings ( message ) ;
220
227
const encodedBodySize = message . body . encodedByteLength ;
221
228
const decodedBody = message . body . decodedData ;
222
229
const decodedBodySize = decodedBody ? decodedBody . byteLength : 0 ;
0 commit comments