Allow both subscriptions and persistedStateReducer
Summary: The previous setup would first check for the presence of a `persistedStateReducer` and then skip the standard subscriptions if this was found. This is a bit of a foot gun because simply by introducing a new function, you'd silently lose your existing subscriptions. There are still some good reasons to support both as some subscriptions may not require persisting as they're directly tied to the state in the app at a given point. Reviewed By: danielbuechele Differential Revision: D15856372 fbshipit-source-id: a36bf40b1ceac431964610571eb70fff687b7607
This commit is contained in:
committed by
Facebook Github Bot
parent
b41c4967a8
commit
d6bb5e5d32
@@ -294,23 +294,20 @@ export default class Client extends EventEmitter {
|
||||
}),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
const apiCallbacks = this.broadcastCallbacks.get(params.api);
|
||||
if (!apiCallbacks) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
const apiCallbacks = this.broadcastCallbacks.get(params.api);
|
||||
if (!apiCallbacks) {
|
||||
return;
|
||||
}
|
||||
|
||||
const methodCallbacks: ?Set<Function> = apiCallbacks.get(
|
||||
params.method,
|
||||
);
|
||||
if (methodCallbacks) {
|
||||
for (const callback of methodCallbacks) {
|
||||
callback(params.params);
|
||||
}
|
||||
const methodCallbacks: ?Set<Function> = apiCallbacks.get(params.method);
|
||||
if (methodCallbacks) {
|
||||
for (const callback of methodCallbacks) {
|
||||
callback(params.params);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
return; // method === 'execute'
|
||||
}
|
||||
|
||||
if (this.sdkVersion < 1) {
|
||||
|
||||
@@ -271,6 +271,7 @@ export default class extends FlipperPlugin<PluginState, *, PersistedState> {
|
||||
debugLog('init()');
|
||||
this.updateCaches('init');
|
||||
this.client.subscribe('events', (event: ImageEvent) => {
|
||||
debugLog('Received events', event);
|
||||
const {surfaceList} = this.props.persistedState;
|
||||
const {attribution} = event;
|
||||
if (attribution instanceof Array && attribution.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user