Skip to content

Revert preserve Platform.select initializers - #58541

Open
vzaidman wants to merge 1 commit into
mainfrom
export-D120147924
Open

vzaidman wants to merge 1 commit into
mainfrom
export-D120147924

Conversation

@vzaidman

Copy link
Copy Markdown
Contributor

Summary:
Reverts #58350, restoring the
long-standing Platform.select inlining behavior.

Per robhogan and vonovak:

Metro has inlined Platform.select() (in release builds only, not configurable) forever really - it goes back to at least 2017, before the start of the Metro repo, eg: react/metro@a317b9d It's always had that behaviour where it collapses side-effects of inactive branches.

Recently, the plugin was copied/re-implemented into RN.

Right now (RN 0.88, Metro 0.87) they both have their own version of the plugin and Metro's runs after RN's, but Metro's shouldn't find anything left to inline and should be a no-op. I couldn't remove it from Metro immediately only because it'd need a major Metro release, but I plan to remove it soon.

So RN's is effectively a continuation of Metro's 8 year old behaviour - we just moved the implementation.

Changelog:
[General][Fixed] - Restore long-standing Platform.select inlining behavior that collapses side effects of inactive branches

See discussion: #58442

Differential Revision: D120147924

Summary:
Reverts #58350, restoring the
long-standing `Platform.select` inlining behavior.

Per robhogan and vonovak:

Metro has inlined Platform.select() (in release builds only, not configurable) forever really - it goes back to at least 2017, before the start of the Metro repo, eg: react/metro@a317b9d It's always had that behaviour where it collapses side-effects of inactive branches.

Recently, the plugin was copied/re-implemented into RN.

Right now (RN 0.88, Metro 0.87) they both have their own version of the plugin and Metro's runs after RN's, but Metro's shouldn't find anything left to inline and should be a no-op. I couldn't remove it from Metro immediately only because it'd need a major Metro release, but I plan to remove it soon.

So RN's is effectively a continuation of Metro's 8 year old behaviour - we just moved the implementation.

Changelog:
[General][Fixed] - Restore long-standing Platform.select inlining behavior that collapses side effects of inactive branches

See discussion: #58442

Differential Revision: D120147924
@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 Sep 15, 2026
@meta-codesync

meta-codesync Bot commented Sep 15, 2026

Copy link
Copy Markdown

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

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. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant