Skip to content

Commit e499bd8

Browse files
j-piaseckifacebook-github-bot
authored andcommitted
Explicitly wake the main loop when scheduling a React revision merge (#57245)
Summary: 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. Differential Revision: D108610347
1 parent c211822 commit e499bd8

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)