Handle empty state for background plugin
Summary: Handles the case when persisted state is undefined which will be the case when the initially selected plugin is not the one running in background Reviewed By: danielbuechele Differential Revision: D10269073 fbshipit-source-id: b7a17b0daa37a486cc7f456338cb97123ad813b7
This commit is contained in:
committed by
Facebook Github Bot
parent
5adc0d0625
commit
396e385651
@@ -125,9 +125,16 @@ export default class extends FlipperPlugin<State, *, PersistedState> {
|
|||||||
const dataType: 'requests' | 'responses' = data.url
|
const dataType: 'requests' | 'responses' = data.url
|
||||||
? 'requests'
|
? 'requests'
|
||||||
: 'responses';
|
: 'responses';
|
||||||
|
if (persistedState) {
|
||||||
|
return {
|
||||||
|
[dataType]: {
|
||||||
|
...persistedState[dataType],
|
||||||
|
[data.id]: data,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
[dataType]: {
|
[dataType]: {
|
||||||
...persistedState[dataType],
|
|
||||||
[data.id]: data,
|
[data.id]: data,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user