From 1afd9f0e31d460aa8a8d41e9c55b20d42e5af358 Mon Sep 17 00:00:00 2001 From: Joshua Gross Date: Mon, 24 Aug 2020 19:37:55 -0700 Subject: [PATCH] UpdateState MountItems should *always* update ViewManagers Summary: I'm removing an ill-informed "optimization" that resulted in some StateUpdates being dropped. For some components (including TextInput) we rely on State updates to request a layout from the ShadowNode layer. In the past we were performing an optimization that didn't update the View layer if the data contained in the State container is identical, but in the case of TextInput and other components, we simply pass an opaque object with no meaningful data to trigger the layouts. In those cases, it could cause a permanent rift between the View layer's StateWrapper and the most recent state object from the C++ perspective. In the case of TextInput this didn't cause tangible bugs because you can always update state using an out-of-date State object, but it's better this way anyway. The other issue is that for some components, we want to know when there's a State update from the Cxx layer. This optimization broke certain logic in those components. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D23306222 fbshipit-source-id: 8ef83149b814de50776674b5fd22406be1db14ba --- .../com/facebook/react/fabric/mounting/MountingManager.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java index 0e951ed4db6..3e1a234246c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java @@ -502,10 +502,7 @@ public class MountingManager { UiThreadUtil.assertOnUiThread(); ViewState viewState = getViewState(reactTag); @Nullable ReadableNativeMap newState = stateWrapper == null ? null : stateWrapper.getState(); - if ((viewState.mCurrentState != null && viewState.mCurrentState.equals(newState)) - || (viewState.mCurrentState == null && stateWrapper == null)) { - return; - } + viewState.mCurrentState = newState; ViewManager viewManager = viewState.mViewManager;