Check whether the request url is null or not to avoid error. (#1146)
Summary:
### The existing issue
[The `buildRow` function in `network/index.js`](c7ff6f6266/desktop/plugins/network/index.tsx (L458)) doesn't check if the url is valid. However,
since the `request` data comes from the App which developers are building,
there will be an error, if the `request.url` is `null` or `undefined`.

When this error occurs, the `NetworkTable` can't go back to normal even I try to click `Clear error and try again`. Only after killing the Flipper desktop and restart again, it can work again.

### How to fix
In order to make `Flipper` desktop more stable, I think it is better to check the url is valid and avoid the crash.
## Changelog
- check the url in the `buildRow` function in `network/index.js`
Pull Request resolved: https://github.com/facebook/flipper/pull/1146
Test Plan:
- [x] Using the same input `request` data, `Flipper` will not show this row and it works as normal.

Reviewed By: jknoxville
Differential Revision: D21502032
Pulled By: passy
fbshipit-source-id: 1dd8ad7f13297ce99680053447024a8563b8a975
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3ddfdcbff1
commit
2dcb73aba5
@@ -455,6 +455,10 @@ function buildRow(
|
||||
if (request == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (request.url == null) {
|
||||
return null;
|
||||
}
|
||||
const url = new URL(request.url);
|
||||
const domain = url.host + url.pathname;
|
||||
const friendlyName = getHeaderValue(request.headers, 'X-FB-Friendly-Name');
|
||||
|
||||
Reference in New Issue
Block a user