don't update when nothing changed

Summary:
The QPL plugin is sending the current time on the device every second, this was causing state updates every second.

QPL: don't update the state, when we did not receive new traces.
Client: only dispatch the update event, when the new state is different from the current.

Reviewed By: passy

Differential Revision: D12956337

fbshipit-source-id: c006540097408ead8fb8c5aac3aaaa220c1a3951
This commit is contained in:
Daniel Büchele
2018-11-07 06:22:13 -08:00
committed by Facebook Github Bot
parent 9ee10392e1
commit 4ff5c7294c

View File

@@ -179,12 +179,14 @@ export default class Client extends EventEmitter {
params.method,
params.params,
);
this.store.dispatch(
setPluginState({
pluginKey,
state: newPluginState,
}),
);
if (persistedState !== newPluginState) {
this.store.dispatch(
setPluginState({
pluginKey,
state: newPluginState,
}),
);
}
} else {
const apiCallbacks = this.broadcastCallbacks.get(params.api);
if (!apiCallbacks) {