From ad43eeceb4a4b377f641e49d18c18d1f24a9f92f Mon Sep 17 00:00:00 2001 From: Dmytro Rykun Date: Tue, 7 May 2024 11:41:54 +0100 Subject: [PATCH] Keep fastAddProperties only in ReactNativeAttributePayloadFabric --- .../src/ReactNativeAttributePayload.js | 70 +------------------ 1 file changed, 2 insertions(+), 68 deletions(-) diff --git a/packages/react-native-renderer/src/ReactNativeAttributePayload.js b/packages/react-native-renderer/src/ReactNativeAttributePayload.js index f5fc4af494e27..0b316ff1ab875 100644 --- a/packages/react-native-renderer/src/ReactNativeAttributePayload.js +++ b/packages/react-native-renderer/src/ReactNativeAttributePayload.js @@ -15,7 +15,6 @@ import { import isArray from 'shared/isArray'; import {enableEarlyReturnForPropDiffing} from 'shared/ReactFeatureFlags'; -import {enableAddPropertiesFastPath} from 'shared/ReactFeatureFlags'; import type {AttributeConfiguration} from './ReactNativeTypes'; @@ -445,68 +444,6 @@ function diffProperties( return updatePayload; } -function fastAddProperties( - updatePayload: null | Object, - nextProps: Object, - validAttributes: AttributeConfiguration, -): null | Object { - let attributeConfig; - let nextProp; - - for (const propKey in nextProps) { - nextProp = nextProps[propKey]; - - if (nextProp === undefined) { - continue; - } - - attributeConfig = validAttributes[propKey]; - - if (attributeConfig === undefined) { - continue; - } - - if (typeof nextProp === 'function') { - nextProp = (true: any); - } - - if (typeof attributeConfig !== 'object') { - if (!updatePayload) { - updatePayload = ({}: {[string]: $FlowFixMe}); - } - updatePayload[propKey] = nextProp; - continue; - } - - if (typeof attributeConfig.process === 'function') { - if (!updatePayload) { - updatePayload = ({}: {[string]: $FlowFixMe}); - } - updatePayload[propKey] = attributeConfig.process(nextProp); - continue; - } - - if (isArray(nextProp)) { - for (let i = 0; i < nextProp.length; i++) { - updatePayload = fastAddProperties( - updatePayload, - nextProp[i], - ((attributeConfig: any): AttributeConfiguration), - ); - } - continue; - } - - updatePayload = fastAddProperties( - updatePayload, - nextProp, - ((attributeConfig: any): AttributeConfiguration), - ); - } - - return updatePayload; -} - /** * addProperties adds all the valid props to the payload after being processed. */ @@ -515,11 +452,8 @@ function addProperties( props: Object, validAttributes: AttributeConfiguration, ): null | Object { - if (enableAddPropertiesFastPath) { - return fastAddProperties(updatePayload, props, validAttributes); - } else { - return diffProperties(updatePayload, emptyObject, props, validAttributes); - } + // TODO: Fast path + return diffProperties(updatePayload, emptyObject, props, validAttributes); } /**