Fixed bug where message could get lost if plugin was selected
Summary:
If the analytics plugin was in the foreground, and messages arrived in quick succession, some messages would not be processed.
Although the code was tested, there were not enough assertions to make sure the loop was correct. coverage !== correctness {emoji:1f605}
This fixes T68101450
Changelog: Fixed regression where analytics messages where lost
Reviewed By: jknoxville
Differential Revision: D21929679
fbshipit-source-id: c9fe2b18a249e40085d99914a809abf14fa7cf8f
This commit is contained in:
committed by
Facebook GitHub Bot
parent
0007ef4b27
commit
2375dd02c3
@@ -172,10 +172,10 @@ export function processMessagesImmediately(
|
||||
messages: Message[],
|
||||
) {
|
||||
const persistedState = getCurrentPluginState(store, plugin, pluginKey);
|
||||
let newPluginState: any;
|
||||
messages.forEach((message) => {
|
||||
newPluginState = processMessage(persistedState, pluginKey, plugin, message);
|
||||
});
|
||||
const newPluginState = messages.reduce(
|
||||
(state, message) => processMessage(state, pluginKey, plugin, message),
|
||||
persistedState,
|
||||
);
|
||||
if (persistedState !== newPluginState) {
|
||||
store.dispatch(
|
||||
setPluginState({
|
||||
|
||||
Reference in New Issue
Block a user