mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Refactor how synchronous updates are queued and executed in FabricUIManager
Summary: As a simple refactor, I want to 1) have `synchronouslyUpdateViewOnUIThread` only catch exceptions for the specific MountItem being synchronously executed, 2) not assume that scheduleMountItem will always cause synchronous execution. I think this makes the logic here a little more clear and it scopes how we swallow exceptions, which could be swallowing too many errors right now actually. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D21911804 fbshipit-source-id: 1b1a465cadd60c72c69b556469276c9ee6b2dfcc
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9ebd852334
commit
d821a9f2a0
@@ -492,16 +492,21 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
|
||||
@ThreadConfined(UI)
|
||||
public void synchronouslyUpdateViewOnUIThread(int reactTag, @NonNull ReadableMap props) {
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
long time = SystemClock.uptimeMillis();
|
||||
|
||||
int commitNumber = mCurrentSynchronousCommitNumber++;
|
||||
|
||||
// We are on the UI thread so this is safe to call. We try to flush any existing
|
||||
// mount instructions that are queued.
|
||||
tryDispatchMountItems();
|
||||
|
||||
try {
|
||||
ReactMarker.logFabricMarker(
|
||||
ReactMarkerConstants.FABRIC_UPDATE_UI_MAIN_THREAD_START, null, commitNumber);
|
||||
if (ENABLE_FABRIC_LOGS) {
|
||||
FLog.d(TAG, "SynchronouslyUpdateViewOnUIThread for tag %d", reactTag);
|
||||
}
|
||||
scheduleMountItem(
|
||||
updatePropsMountItem(reactTag, props), commitNumber, time, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
updatePropsMountItem(reactTag, props).execute(mMountingManager);
|
||||
} catch (Exception ex) {
|
||||
// TODO T42943890: Fix animations in Fabric and remove this try/catch
|
||||
ReactSoftException.logSoftException(
|
||||
|
||||
Reference in New Issue
Block a user