Fixed broken navigation plugin
Summary: The navigation plugin threw exceptions, as the defaultPersisted state was not mixed into the already stored state, making some fields unreadable Reviewed By: jknoxville Differential Revision: D19554291 fbshipit-source-id: 57f045aa1eae10682e44d479b9aecb51f0391b9e
This commit is contained in:
committed by
Facebook Github Bot
parent
23625f7a89
commit
e9ff9addc6
@@ -8,7 +8,7 @@
|
|||||||
* @flow strict-local
|
* @flow strict-local
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {FlipperPlugin, bufferToBlob, FlexColumn} from 'flipper';
|
import {FlipperPlugin, FlexColumn, bufferToBlob} from 'flipper';
|
||||||
import {
|
import {
|
||||||
BookmarksSidebar,
|
BookmarksSidebar,
|
||||||
SaveBookmarkDialog,
|
SaveBookmarkDialog,
|
||||||
|
|||||||
@@ -143,10 +143,7 @@ export function processMessageImmediately(
|
|||||||
},
|
},
|
||||||
message: {method: string; params?: any},
|
message: {method: string; params?: any},
|
||||||
) {
|
) {
|
||||||
const persistedState: any =
|
const persistedState = getCurrentPluginState(store, plugin, pluginKey);
|
||||||
store.getState().pluginStates[pluginKey] ??
|
|
||||||
plugin.defaultPersistedState ??
|
|
||||||
{};
|
|
||||||
const newPluginState = processMessage(
|
const newPluginState = processMessage(
|
||||||
persistedState,
|
persistedState,
|
||||||
pluginKey,
|
pluginKey,
|
||||||
@@ -217,10 +214,7 @@ export async function processMessageQueue(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// there are messages to process! lets do so until we have to idle
|
// there are messages to process! lets do so until we have to idle
|
||||||
const persistedState =
|
const persistedState = getCurrentPluginState(store, plugin, pluginKey);
|
||||||
store.getState().pluginStates[pluginKey] ??
|
|
||||||
plugin.defaultPersistedState ??
|
|
||||||
{};
|
|
||||||
let offset = 0;
|
let offset = 0;
|
||||||
let newPluginState = persistedState;
|
let newPluginState = persistedState;
|
||||||
do {
|
do {
|
||||||
@@ -267,3 +261,15 @@ function getPendingMessages(
|
|||||||
): Message[] {
|
): Message[] {
|
||||||
return store.getState().pluginMessageQueue[pluginKey] || [];
|
return store.getState().pluginMessageQueue[pluginKey] || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCurrentPluginState(
|
||||||
|
store: MiddlewareAPI,
|
||||||
|
plugin: {defaultPersistedState: any},
|
||||||
|
pluginKey: string,
|
||||||
|
) {
|
||||||
|
// possible optimization: don't spread default state here by put proper default state when initializing clients
|
||||||
|
return {
|
||||||
|
...plugin.defaultPersistedState,
|
||||||
|
...store.getState().pluginStates[pluginKey],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|||||||
@@ -346,5 +346,8 @@
|
|||||||
],
|
],
|
||||||
"app-react-outline": [
|
"app-react-outline": [
|
||||||
16
|
16
|
||||||
|
],
|
||||||
|
"send-outline": [
|
||||||
|
16
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user