Ensure that highlight always responds to prevent timeouts

Summary: In a previous diff D32278523 (8764da7c0b) The desktop request was changed from send to call. Call expects a response and not all code paths return a response. Most calls to set highlight are timing out.

Reviewed By: mweststrate

Differential Revision: D38074704

fbshipit-source-id: 6e85416d6b6470efaa177ad1b74420c8237366d5
This commit is contained in:
Luke De Feo
2022-07-25 14:51:41 -07:00
committed by Facebook GitHub Bot
parent 3fbf1215ec
commit f72406b06c
3 changed files with 10 additions and 7 deletions

View File

@@ -17,9 +17,8 @@ public interface FlipperReceiver {
* Reciver for a request sent from the Flipper desktop client.
*
* @param params Optional set of parameters sent with the request.
* @param responder Optional responder for request. Some requests don't warrant a response
* through. In this case the request should be made from the desktop using send() instead of
* call().
* @param responder Responder for request, ensure to respond otherwise request will time out on
* the desktop side
*/
void onReceive(FlipperObject params, FlipperResponder responder) throws Exception;
}

View File

@@ -420,6 +420,8 @@ public class InspectorFlipperPlugin implements FlipperPlugin {
}
mHighlightedId = nodeId;
mHighlightedAlignmentMode = isAlignmentMode;
responder.success();
}
};

View File

@@ -372,6 +372,10 @@ NSObject* flattenLayoutEditorMessage(NSObject* field) {
- (void)onCallSetHighlighted:(NSString*)objectId
withResponder:(id<FlipperResponder>)responder {
if (objectId == nil || [objectId isKindOfClass:[NSNull class]]) {
[responder error:@{@"error" : @"parameter ObjectID was null"}];
return;
}
if (_lastHighlightedNode != nil) {
id lastHighlightedObject =
[_trackedObjects objectForKey:_lastHighlightedNode];
@@ -387,10 +391,6 @@ NSObject* flattenLayoutEditorMessage(NSObject* field) {
_lastHighlightedNode = nil;
}
if (objectId == nil || [objectId isKindOfClass:[NSNull class]]) {
return;
}
id object = [_trackedObjects objectForKey:objectId];
if (object == nil) {
SKLog(@"tried to setHighlighted for untracked id, objectId: %@", objectId);
@@ -402,6 +402,8 @@ NSObject* flattenLayoutEditorMessage(NSObject* field) {
[descriptor setHighlighted:YES forNode:object];
_lastHighlightedNode = objectId;
[responder success:@{}];
}
- (void)onCallSetSearchActive:(BOOL)active