Commit a493a8a
Revert preserve Platform.select initializers (#58541)
Summary:
Pull Request resolved: #58541
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
Reviewed By: javache
Differential Revision: D120147924
fbshipit-source-id: 0ec9cc7f8eade4e6276d0e049bc5fedfc613017f1 parent a9473b5 commit a493a8a
2 files changed
Lines changed: 6 additions & 39 deletions
File tree
- packages/react-native-babel-preset/src
- __tests__
Lines changed: 0 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
483 | 483 | | |
484 | 484 | | |
485 | 485 | | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | 486 | | |
506 | 487 | | |
507 | 488 | | |
| |||
Lines changed: 6 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
446 | | - | |
447 | | - | |
448 | | - | |
| 446 | + | |
449 | 447 | | |
450 | 448 | | |
451 | 449 | | |
| |||
522 | 520 | | |
523 | 521 | | |
524 | 522 | | |
525 | | - | |
526 | | - | |
527 | | - | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
528 | 528 | | |
529 | 529 | | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | 530 | | |
545 | 531 | | |
546 | 532 | | |
| |||
0 commit comments