From a8a512fe443a1207983d9f53f561f09240f415a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=BCchele?= Date: Fri, 19 Oct 2018 05:12:27 -0700 Subject: [PATCH] network defaultPersistedState Summary: using defaultPersistedState in network plugin to remove unnecessary null check Reviewed By: passy Differential Revision: D10446988 fbshipit-source-id: b0290e4b678c36c031ecd0fba88cdb9add24b46e --- src/plugins/network/index.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/plugins/network/index.js b/src/plugins/network/index.js index f4c20a93e..97d2a98f4 100644 --- a/src/plugins/network/index.js +++ b/src/plugins/network/index.js @@ -116,8 +116,11 @@ export default class extends FlipperPlugin { 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 { 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, }, };