network defaultPersistedState
Summary: using defaultPersistedState in network plugin to remove unnecessary null check Reviewed By: passy Differential Revision: D10446988 fbshipit-source-id: b0290e4b678c36c031ecd0fba88cdb9add24b46e
This commit is contained in:
committed by
Facebook Github Bot
parent
4090c2d096
commit
a8a512fe44
@@ -116,8 +116,11 @@ export default class extends FlipperPlugin<State, *, PersistedState> {
|
||||
static id = 'Network';
|
||||
static icon = 'internet';
|
||||
static keyboardActions = ['clear'];
|
||||
|
||||
static subscribed = [];
|
||||
static defaultPersistedState = {
|
||||
requests: {},
|
||||
responses: {},
|
||||
};
|
||||
|
||||
static persistedStateReducer = (
|
||||
persistedState: PersistedState,
|
||||
@@ -127,16 +130,10 @@ export default class extends FlipperPlugin<State, *, PersistedState> {
|
||||
const dataType: 'requests' | 'responses' = data.url
|
||||
? 'requests'
|
||||
: 'responses';
|
||||
if (persistedState) {
|
||||
return {
|
||||
[dataType]: {
|
||||
...persistedState[dataType],
|
||||
[data.id]: data,
|
||||
},
|
||||
};
|
||||
}
|
||||
return {
|
||||
...persistedState,
|
||||
[dataType]: {
|
||||
...persistedState[dataType],
|
||||
[data.id]: data,
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user