Addresses an issue with Flipper message identifier
Summary: This change addresses a problem with using data.id straight into the if statement. If `data.id` is not undefined but has a value of 0 then the expression evaluates to false. Right now, that wasn't the intended usage. Using this change to also export some types from Client. Reviewed By: passy Differential Revision: D30069746 fbshipit-source-id: 04a8d161efceadf7a38ee556be70c15b45c11056
This commit is contained in:
committed by
Facebook GitHub Bot
parent
6791b29e45
commit
b76ce357eb
@@ -54,12 +54,16 @@ export type ClientExport = {
|
|||||||
query: ClientQuery;
|
query: ClientQuery;
|
||||||
};
|
};
|
||||||
|
|
||||||
type Params = {
|
export type Params = {
|
||||||
api: string;
|
api: string;
|
||||||
method: string;
|
method: string;
|
||||||
params?: Object;
|
params?: Object;
|
||||||
};
|
};
|
||||||
type RequestMetadata = {method: string; id: number; params: Params | undefined};
|
export type RequestMetadata = {
|
||||||
|
method: string;
|
||||||
|
id: number;
|
||||||
|
params: Params | undefined;
|
||||||
|
};
|
||||||
|
|
||||||
const handleError = (store: Store, device: BaseDevice, error: ErrorType) => {
|
const handleError = (store: Store, device: BaseDevice, error: ErrorType) => {
|
||||||
if (store.getState().settingsState.suppressPluginErrors) {
|
if (store.getState().settingsState.suppressPluginErrors) {
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ class ServerWebSocket extends ServerWebSocketBase {
|
|||||||
error?: ErrorType | undefined;
|
error?: ErrorType | undefined;
|
||||||
} = json;
|
} = json;
|
||||||
|
|
||||||
if (data.hasOwnProperty('id') && data.id) {
|
if (data.hasOwnProperty('id') && data.id !== undefined) {
|
||||||
const callbacks = pendingRequests.get(data.id);
|
const callbacks = pendingRequests.get(data.id);
|
||||||
if (!callbacks) {
|
if (!callbacks) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user