Add method field to persistedStateReducer
Summary: When sending a message from the mobile side, you call something like: `send(method: string, params: Object)` But when receiving it in the reducer, you only get the params. Adding method so you can distinguish them. Reviewed By: passy Differential Revision: D10447890 fbshipit-source-id: f1fe925e82355866f86b322ecd3c72c604ae86af
This commit is contained in:
committed by
Facebook Github Bot
parent
48f9b350fe
commit
d48f93edea
@@ -173,6 +173,7 @@ export default class Client extends EventEmitter {
|
|||||||
// $FlowFixMe: We checked persistedStateReducer exists
|
// $FlowFixMe: We checked persistedStateReducer exists
|
||||||
const newPluginState = persistingPlugin.persistedStateReducer(
|
const newPluginState = persistingPlugin.persistedStateReducer(
|
||||||
persistedState,
|
persistedState,
|
||||||
|
params.method,
|
||||||
params.params,
|
params.params,
|
||||||
);
|
);
|
||||||
this.store.dispatch(
|
this.store.dispatch(
|
||||||
|
|||||||
@@ -126,7 +126,11 @@ export class FlipperPlugin<S = *, A = *, P = *> extends FlipperBasePlugin<
|
|||||||
A,
|
A,
|
||||||
P,
|
P,
|
||||||
> {
|
> {
|
||||||
static persistedStateReducer: ?(persistedState: P, data: Object) => $Shape<P>;
|
static persistedStateReducer: ?(
|
||||||
|
persistedState: P,
|
||||||
|
method: string,
|
||||||
|
data: Object,
|
||||||
|
) => $Shape<P>;
|
||||||
static getActiveNotifications: ?(persistedState: P) => Array<Notification>;
|
static getActiveNotifications: ?(persistedState: P) => Array<Notification>;
|
||||||
|
|
||||||
constructor(props: Props<*>) {
|
constructor(props: Props<*>) {
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ export default class extends FlipperPlugin<State, *, PersistedState> {
|
|||||||
|
|
||||||
static persistedStateReducer = (
|
static persistedStateReducer = (
|
||||||
persistedState: PersistedState,
|
persistedState: PersistedState,
|
||||||
|
method: string,
|
||||||
data: Request | Response,
|
data: Request | Response,
|
||||||
): PersistedState => {
|
): PersistedState => {
|
||||||
const dataType: 'requests' | 'responses' = data.url
|
const dataType: 'requests' | 'responses' = data.url
|
||||||
|
|||||||
Reference in New Issue
Block a user