Skip to content

Commit 0cdb59f

Browse files
j-piaseckimeta-codesync[bot]
authored andcommitted
Explicitly wake the main loop when scheduling a React revision merge (#57245)
Summary: Pull Request resolved: #57245 Changelog: [IOS][FIXED] Add an explicit wake up call to the main loop hen scheduling a React revision merge I could be possible that on idle screens the run loop is asleep, so without an explicit wake up call, the scheduled merges aren't processed. This diff adds an explicit wake call when a merge is scheduled. Reviewed By: rubennorte Differential Revision: D108610347 fbshipit-source-id: 5ea02237b2152072b49a29482617fabbee34259f
1 parent 6fa3306 commit 0cdb59f

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

packages/react-native/React/Fabric/RCTSurfacePresenter.mm

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,16 @@ - (void)schedulerShouldMergeReactRevision:(SurfaceId)surfaceId
349349
return;
350350
}
351351

352-
std::lock_guard<std::mutex> lock(_pendingReactRevisionMergesMutex);
353-
_pendingReactRevisionMerges.insert(surfaceId);
352+
bool needsWake = false;
353+
{
354+
std::lock_guard<std::mutex> lock(_pendingReactRevisionMergesMutex);
355+
needsWake = _pendingReactRevisionMerges.empty();
356+
_pendingReactRevisionMerges.insert(surfaceId);
357+
}
358+
359+
if (needsWake) {
360+
CFRunLoopWakeUp(CFRunLoopGetMain());
361+
}
354362
}
355363

356364
- (void)_mergeReactRevisionForSurfaceId:(SurfaceId)surfaceId

0 commit comments

Comments
 (0)