Skip to content

Commit

Permalink
Avoid RCTUnsafeExecuteOnMainQueueSync from RCTUIManager
Browse files Browse the repository at this point in the history
These calls are only needed for a temporary Fabric workaround and would result in a deadlock since we also call `RCTUnsafeExecuteOnUIManagerQueueSync` from the main thread during window resize.

This is needed for now in Fabric only to call the temporary `componentViewName_DO_NOT_USE_THIS_IS_BROKEN` workaround on views, which we don't have on desktop since we're a way off from using Fabric (and hopefully this workaround will be gone then).

It was originally added here facebook@ffc7ec9

At Meta we have disabled these lines since May 2021 to fix crashes in production.
  • Loading branch information
appden authored and christophpurrer committed Jul 21, 2022
1 parent 84c0863 commit c9599c1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions React/Modules/RCTUIManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ - (NSString *)viewNameForReactTag:(NSNumber *)reactTag
return name;
}

#if !TARGET_OS_OSX // [TODO(macOS GH#774)
__block RCTPlatformView *view; // TODO(macOS GH#774)
RCTUnsafeExecuteOnMainQueueSync(^{
view = self->_viewRegistry[reactTag];
Expand All @@ -367,6 +368,7 @@ - (NSString *)viewNameForReactTag:(NSNumber *)reactTag
}

#pragma clang diagnostic pop
#endif // ]TODO(macOS GH#774)
return nil;
}

Expand Down Expand Up @@ -1135,6 +1137,7 @@ - (void)synchronouslyUpdateViewOnUIThread:(NSNumber *)reactTag viewName:(NSStrin
RCTShadowView *shadowView = _shadowViewRegistry[reactTag];
RCTComponentData *componentData = _componentDataByName[shadowView.viewName];

#if !TARGET_OS_OSX // [TODO(macOS GH#774)
// Achtung! Achtung!
// This is a remarkably hacky and ugly workaround.
// We need this only temporary for some testing. We need this hack until Fabric fully implements command-execution
Expand All @@ -1152,6 +1155,7 @@ - (void)synchronouslyUpdateViewOnUIThread:(NSNumber *)reactTag viewName:(NSStrin
}
}
#pragma clang diagnostic pop
#endif // ]TODO(macOS GH#774)

Class managerClass = componentData.managerClass;
RCTModuleData *moduleData = [_bridge moduleDataForName:RCTBridgeModuleNameForClass(managerClass)];
Expand Down

0 comments on commit c9599c1

Please sign in to comment.