Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Loading from Metro" banner rendering twice and remaining visible for ~15 seconds on each reload #43943

Closed
brentvatne opened this issue Apr 5, 2024 · 1 comment
Assignees
Labels
DX Issues concerning how the developer experience can be improved. p: Expo Partner: Expo Partner Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)

Comments

@brentvatne
Copy link
Collaborator

brentvatne commented Apr 5, 2024

Description

It looks like the loading "Loading from Metro" banner is rendered twice on each app reload (when you press r), and it takes about 15 seconds for the second banner to disappear. Reproduced on a new project with rc.6 created using https://gist.github.com/cipolleschi/82b7a9561b8861330efabbd3eb08c6f5. More details below.

Steps to reproduce

  1. Clone https://github.com/brentvatne/repro-metro-loading-status (or, alternatively, create a new repo as documented in "Test Your Library against React Native 0.74.0-rcs." - that is exactly the process used for creating this repro).
  2. Install deps as outlined in the library testing doc:
cd ios
bundle install
RCT_NEW_ARCH_ENABLED=1 bundle exec pod install
open AppLibTest.xcworkspace
cd ../..
yarn start
  1. Build and run for iOS (Xcode or through RNC CLI, your choice)
  2. When the app is running, press r to reload it, and observe as the banner rudely overstays its welcome

React Native Version

0.74.0-rc.6

Affected Platforms

Runtime - iOS

Areas

Fabric - The New Renderer, TurboModule - The New Native Module System, Bridgeless - The New Initialization Flow

Output of npx react-native info

System:
  OS: macOS 14.3.1
  CPU: (12) arm64 Apple M3 Pro
  Memory: 346.77 MB / 36.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.12.0
    path: ~/.nvm/versions/node/v20.12.0/bin/node
  Yarn:
    version: 1.22.21
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.5.0
    path: ~/.nvm/versions/node/v20.12.0/bin/npm
  Watchman:
    version: 2024.03.25.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.4
      - iOS 17.4
      - macOS 14.4
      - tvOS 17.4
      - visionOS 1.1
      - watchOS 10.4
  Android SDK:
    API Levels:
      - "34"
    Build Tools:
      - 33.0.1
      - 34.0.0
    System Images:
      - android-34 | Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2023.2 AI-232.10227.8.2321.11479570
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 2.7.8
    path: /Users/brent/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.0-rc.6
    wanted: 0.74.0-rc.6
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

n/a

Reproducer

https://github.com/brentvatne/repro-metro-loading-status

Screenshots and Videos

New arch enabled

Screen_Recording_2024-04-04_at_5.55.23_PM.mov

New arch disabled

Screen_Recording_2024-04-04_at_5.55.23_PM.mov
@brentvatne brentvatne added Needs: Triage 🔍 Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules) labels Apr 5, 2024
@cortinico cortinico added DX Issues concerning how the developer experience can be improved. and removed Needs: Triage 🔍 labels Apr 8, 2024
cipolleschi added a commit to cipolleschi/react-native that referenced this issue Apr 8, 2024
Summary:
Following up facebook#43943, the metro loading banner is presented twice in Bridgeless mode.

This happens because both the RCTInstance and the RCTHost are listening to the Reload Command and issuing the instructions to refetch the JSBundle and to present the banner.

The RCTInstance should not concern itself with lifecycle events, owned by the RCTHost.

## Changelog:
[iOS][Fixed] - Avoid to show Metro Loading banner twice.

Reviewed By: cortinico

Differential Revision: D55870640
cipolleschi added a commit to cipolleschi/react-native that referenced this issue Apr 8, 2024
Summary:

Following up facebook#43943, the metro loading banner is presented twice in Bridgeless mode.

This happens because both the RCTInstance and the RCTHost are listening to the Reload Command and issuing the instructions to refetch the JSBundle and to present the banner.

The RCTInstance should not concern itself with lifecycle events, owned by the RCTHost.

## Changelog:
[iOS][Fixed] - Avoid to show Metro Loading banner twice.

Reviewed By: cortinico

Differential Revision: D55870640
cipolleschi added a commit to cipolleschi/react-native that referenced this issue Apr 8, 2024
Summary:

Following up facebook#43943, the metro loading banner is presented twice in Bridgeless mode.

This happens because both the RCTInstance and the RCTHost are listening to the Reload Command and issuing the instructions to refetch the JSBundle and to present the banner.

The RCTInstance should not concern itself with lifecycle events, owned by the RCTHost.

## Changelog:
[iOS][Fixed] - Avoid to show Metro Loading banner twice.

Reviewed By: cortinico

Differential Revision: D55870640
facebook-github-bot pushed a commit that referenced this issue Apr 8, 2024
Summary:
Pull Request resolved: #43967

Following up #43943, the metro loading banner is presented twice in Bridgeless mode.

This happens because both the RCTInstance and the RCTHost are listening to the Reload Command and issuing the instructions to refetch the JSBundle and to present the banner.

The RCTInstance should not concern itself with lifecycle events, owned by the RCTHost.

## Changelog:
[iOS][Fixed] - Avoid to show Metro Loading banner twice.

Reviewed By: cortinico

Differential Revision: D55870640

fbshipit-source-id: addb67d3226f7d7db20736309172a42fc15f3aa3
cortinico pushed a commit that referenced this issue Apr 9, 2024
Summary:
Pull Request resolved: #43967

Following up #43943, the metro loading banner is presented twice in Bridgeless mode.

This happens because both the RCTInstance and the RCTHost are listening to the Reload Command and issuing the instructions to refetch the JSBundle and to present the banner.

The RCTInstance should not concern itself with lifecycle events, owned by the RCTHost.

## Changelog:
[iOS][Fixed] - Avoid to show Metro Loading banner twice.

Reviewed By: cortinico

Differential Revision: D55870640

fbshipit-source-id: addb67d3226f7d7db20736309172a42fc15f3aa3
@cortinico
Copy link
Contributor

✅ Picked, this will land in 0.74 RC8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Issues concerning how the developer experience can be improved. p: Expo Partner: Expo Partner Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)
Projects
None yet
Development

No branches or pull requests

4 participants