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

[Bridgeless] Multiple bundles loaded on android when locale changed natively #44730

Closed
itsramiel opened this issue May 30, 2024 · 4 comments
Closed
Labels
📦Bundler Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Platform: Android Android applications. Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)

Comments

@itsramiel
Copy link

itsramiel commented May 30, 2024

Description

I am developing an android module that changes the app locale using AppCompatDelegate api setApplicationLocales as in the android guide which reloads the app as a side effect, but every time the locale is changed and I refresh the app an extra line of:
Running "SampleApp" with {"rootTag":101,"initialProps":{},"fabric":true}
is logged to the console. I am not sure if this means there are multiple bundles loaded and there is a memory leak?

I added a console.log to App.tsx and that console.log is only logged once not as many times as there are the Running .... lines so I am not sure about the multiple bundles loaded term

Check videos below to better understand

Happens only on bridgeless

Steps to reproduce

  1. clone the reproduction repo
  2. install dependencies with yarn install
  3. run android app with npx react-native@latest run-android
  4. click on set locale button
  5. refresh the app <<----- You should see an extra Running "SampleApp" with {"rootTag":101,"initialProps":{},"fabric":true}

You will see the Running.... as many times as you pressed on the set locale.

Note that the set locale button simply changes the app language as recommended by android and also that it works when bridgeless is disabled

React Native Version

0.74.1

Affected Platforms

Runtime - Android

Output of npx react-native info

info Fetching system and libraries information...
System:
  OS: macOS 14.3.1
  CPU: (14) arm64 Apple M3 Max
  Memory: 1.81 GB / 36.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.11.1
    path: ~/.nvm/versions/node/v20.11.1/bin/node
  Yarn:
    version: 3.6.4
    path: ~/.nvm/versions/node/v20.11.1/bin/yarn
  npm:
    version: 10.2.4
    path: ~/.nvm/versions/node/v20.11.1/bin/npm
  Watchman:
    version: 2024.01.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /Users/itsramiel/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11330709
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 3.3.0
    path: /Users/itsramiel/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.1
    wanted: 0.74.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true


### Stacktrace or Logs

```text
No Failure

Reproducer

https://github.com/itsramiel/RN_Bridgeless_Repro

Screenshots and Videos

New Arch: true
Bridgeless: true
reproducable: true

Screen.Recording.2024-05-30.at.7.41.17.PM.mov

New Arch: true
Bridgeless: false
reproducable: false

Screen.Recording.2024-05-30.at.7.43.01.PM.mov

@github-actions github-actions bot added Platform: Android Android applications. 📦Bundler labels May 30, 2024
@cortinico cortinico added Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules) and removed Needs: Triage 🔍 labels Jun 4, 2024
@cortinico
Copy link
Contributor

@itsramiel thanks for attaching a reproducer here.
This is indeed an interesting bug and there is something going on with Bridgeless. I'll try to look into it and get back to you

@alanleedev
Copy link
Contributor

@itsramiel Thanks for reporting. I did confirm this was a problem but it was recently fixed here: PR #44873
@cortinico The change log for the PR probably needs to be updated to state what was fixed.

@itsramiel
Copy link
Author

@itsramiel Thanks for reporting. I did confirm this was a problem but it was recently fixed here: PR #44873 @cortinico The change log for the PR probably needs to be updated to state what was fixed.

Awesome I will be closing this, and recreate the issue if it still exists after the pr. Do you know which version will have the changes in the pr?

@cortinico
Copy link
Contributor

In theory this should go out in 0.76. If you want it to be picked in 0.74/0.75 you should open a pick request here:

https://github.com/reactwg/react-native-releases/blob/main/docs/faq.md#what-is-a-pick-request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦Bundler Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Platform: Android Android applications. Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)
Projects
None yet
Development

No branches or pull requests

3 participants