Skip to content

Move nativeId parsing into the Props ctor initializer list#57339

Closed
javache wants to merge 1 commit into
react:mainfrom
javache:export-D109691981
Closed

Move nativeId parsing into the Props ctor initializer list#57339
javache wants to merge 1 commit into
react:mainfrom
javache:export-D109691981

Conversation

@javache

@javache javache commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary:
Every Props subclass parses its fields in its 3-arg ctor's initializer list, but Props was the odd one out — its 3-arg ctor had an empty initializer list and a body that called a separate Props::initialize method, which then assigned nativeId and (on Android) ran initializeDynamicProps.

Fold the nativeId parse back into the initializer list and inline the Android initializeDynamicProps call into the ctor body, matching the subclass pattern.

This removes the only remaining external caller of Props::initialize: YogaStylableProps's ctor was constructing its Props subobject via Props() and then calling initialize(...) from its body. Replace with the standard Props(ctx, sourceProps, rawProps, filterObjectKeys) initializer-list chain. With both call sites gone, delete Props::initialize outright.

Behaviour is unchanged: the work that initialize did still runs on the same construction path, just via the ctor itself.

Changelog:
[Internal]

Differential Revision: D109691981

Summary:
Every Props subclass parses its fields in its 3-arg ctor's initializer list, but `Props` was the odd one out — its 3-arg ctor had an empty initializer list and a body that called a separate `Props::initialize` method, which then assigned `nativeId` and (on Android) ran `initializeDynamicProps`.

Fold the `nativeId` parse back into the initializer list and inline the Android `initializeDynamicProps` call into the ctor body, matching the subclass pattern.

This removes the only remaining external caller of `Props::initialize`: `YogaStylableProps`'s ctor was constructing its `Props` subobject via `Props()` and then calling `initialize(...)` from its body. Replace with the standard `Props(ctx, sourceProps, rawProps, filterObjectKeys)` initializer-list chain. With both call sites gone, delete `Props::initialize` outright.

Behaviour is unchanged: the work that `initialize` did still runs on the same construction path, just via the ctor itself.

Changelog:
[Internal]

Differential Revision: D109691981
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 25, 2026
@meta-codesync

meta-codesync Bot commented Jun 25, 2026

Copy link
Copy Markdown

@javache has exported this pull request. If you are a Meta employee, you can view the originating Diff in D109691981.

@meta-codesync

meta-codesync Bot commented Jun 25, 2026

Copy link
Copy Markdown

This pull request has been merged in 9052f0b.

@meta-codesync meta-codesync Bot added the Merged This PR has been merged. label Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant