PluginContainer.tsx

Reviewed By: passy

Differential Revision: D17258340

fbshipit-source-id: 26ce421345f6152efe7da07daf649395e299af14
This commit is contained in:
John Knox
2019-09-09 06:49:30 -07:00
committed by Facebook Github Bot
parent 96d9c9638c
commit 6e8b31e2ed
2 changed files with 21 additions and 25 deletions

View File

@@ -46,14 +46,14 @@ export default function reducer(
return {...state};
} else if (action.type === 'CLEAR_PLUGIN_STATE') {
const {payload} = action;
return Object.keys(state).reduce((newState, pluginKey) => {
return Object.keys(state).reduce((newState: State, pluginKey) => {
// Only add the pluginState, if its from a plugin other than the one that
// was removed. pluginKeys are in the form of ${clientID}#${pluginID}.
const clientId = pluginKey.slice(0, pluginKey.lastIndexOf('#'));
const pluginId = pluginKey.split('#').pop();
if (
clientId !== payload.clientId ||
payload.devicePlugins.has(pluginId)
(pluginId && payload.devicePlugins.has(pluginId))
) {
newState[pluginKey] = state[pluginKey];
}