Bust surfaceActiveForExecution cache after executing a batch of items

Summary:
Since we were not busting the `surfaceActiveForExecution` cache, it is very possible (likely, even!) that a surfaceId is invalidated in between UI ticks but we keep executing items for that surface at the next tick.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22055303

fbshipit-source-id: 351c13535e85b30e00684fe35fc4aa79ccb5961c
This commit is contained in:
Joshua Gross
2020-06-15 18:03:22 -07:00
committed by Facebook GitHub Bot
parent e0294aff68
commit 33ed358330
@@ -326,6 +326,7 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
@Nullable Object stateWrapper,
boolean isLayoutable) {
ThemedReactContext context = mReactContextForRootTag.get(rootTag);
String component = getFabricComponentName(componentName);
synchronized (mPreMountItemsLock) {
mPreMountItems.add(
@@ -667,6 +668,7 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
didDispatchItems = dispatchMountItems();
} catch (Throwable e) {
mReDispatchCounter = 0;
mLastExecutedMountItemSurfaceId = -1;
throw e;
} finally {
// Clean up after running dispatchMountItems - even if an exception was thrown
@@ -693,6 +695,7 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
tryDispatchMountItems();
}
mReDispatchCounter = 0;
mLastExecutedMountItemSurfaceId = -1;
}
@UiThread
@@ -947,6 +950,7 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
}
} finally {
mInDispatch = false;
mLastExecutedMountItemSurfaceId = -1;
}
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);