From 8ac0ccbb910c2d84019761ec80a33478f124a133 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Tue, 3 Jun 2025 02:42:38 -0700 Subject: [PATCH] Add tracing section for event loop tick work for IntersectionObserver (#51744) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51744 Changelog: [internal] TSIA Reviewed By: rshest Differential Revision: D75789346 fbshipit-source-id: fa32cd3e5d9809bcbad48f0a6f1706efcce34d7f --- .../intersection/IntersectionObserverManager.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactCommon/react/renderer/observers/intersection/IntersectionObserverManager.cpp b/packages/react-native/ReactCommon/react/renderer/observers/intersection/IntersectionObserverManager.cpp index 09ff825453c..fdc4af7d5f6 100644 --- a/packages/react-native/ReactCommon/react/renderer/observers/intersection/IntersectionObserverManager.cpp +++ b/packages/react-native/ReactCommon/react/renderer/observers/intersection/IntersectionObserverManager.cpp @@ -243,6 +243,12 @@ void IntersectionObserverManager::updateIntersectionObservations( // In those cases it is ok to dispatch the notifications now, because the // current state is already accurate. + if (observersPendingInitialization_.empty()) { + return; + } + + TraceSection s("IntersectionObserverManager::updateIntersectionObservations"); + std::unordered_map rootShadowNodeCache; for (auto observer : observersPendingInitialization_) { @@ -297,7 +303,8 @@ void IntersectionObserverManager::updateIntersectionObservations( SurfaceId surfaceId, const RootShadowNode* rootShadowNode, HighResTimeStamp time) { - TraceSection s("IntersectionObserverManager::updateIntersectionObservations"); + TraceSection s( + "IntersectionObserverManager::updateIntersectionObservations(mount)"); std::vector entries;