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

Keep ReactImageView logging disabled in bridgeless #44578

Closed
wants to merge 1 commit into from

Conversation

RSNara
Copy link
Contributor

@RSNara RSNara commented May 14, 2024

Summary:
In bridgeless mode, when we fix themed react context, this code-path slows rendering (in dev), starting a feedback loop.

Best understanding of feedback loop:

  1. Some code tries to render an component.
  2. Fabric preallocates the component, assigns a null src to the image.
  3. The image component warns that there's no src: RNLog.w.
  4. Prior to the themed react context fix, RNLog.w() would just noop: this ThemedReactContext.hasActiveReactInstance() returned false.
  5. After the themed react context fix, RNLog.w() dispatches a native -> javascript call. This renders a LogBox.
  6. LogBox renders a , which re-starts this loop.

We're not sure what the right long-term solution here is. But, I will follow up! But, until then, it's important that we unblock the ThemedReactContext fix.

Changelog: [Internal]

Differential Revision: D56970919

@facebook-github-bot facebook-github-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 May 14, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D56970919

@analysis-bot
Copy link

analysis-bot commented May 14, 2024

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 19,526,143 +10
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 22,896,043 -7
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 86dffb3
Branch: main

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D56970919

RSNara added a commit to RSNara/react-native that referenced this pull request May 15, 2024
Summary:

In bridgeless mode, when we fix themed react context, this code-path slows rendering (in dev), starting a feedback loop.

Best understanding of feedback loop:
1. Some code tries to render an <Image/> component.
2. Fabric preallocates the <Image/> component, assigns a null src to the image.
3. The image component warns that there's no src: [RNLog.w](https://www.internalfb.com/code/fbsource/[8cf3936aee379b1f5fa31cc8f02745ceafa72ff3]/xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageView.java?lines=603-609).
4. **Prior to the themed react context fix,** RNLog.w() would just noop: this [ThemedReactContext.hasActiveReactInstance()](https://www.internalfb.com/code/fbsource/[19ba3ff63f5342a4ba86e18f2e790c69c6cfc7e1]/xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/util/RNLog.kt?lines=93-95) returned false.
5. **After the themed react context fix,** RNLog.w() dispatches a [native -> javascript call](https://github.com/facebook/react-native/blob/44f9371f246932215627a7ea01fbedf5c13e3019/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/util/RNLog.kt#L94). This renders a LogBox.
6. LogBox renders a <Image/>, which re-starts this loop.

We're not sure what the right long-term solution here is. But, I will follow up! But, until then, it's important that we unblock the ThemedReactContext fix.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D56970919
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D56970919

Summary:

In bridgeless mode, when we fix themed react context, this code-path slows rendering (in dev), starting a feedback loop.

Best understanding of feedback loop:
1. Some code tries to render an <Image/> component.
2. Fabric preallocates the <Image/> component, assigns a null src to the image.
3. The image component warns that there's no src: [RNLog.w](https://www.internalfb.com/code/fbsource/[8cf3936aee379b1f5fa31cc8f02745ceafa72ff3]/xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageView.java?lines=603-609).
4. **Prior to the themed react context fix,** RNLog.w() would just noop: this [ThemedReactContext.hasActiveReactInstance()](https://www.internalfb.com/code/fbsource/[19ba3ff63f5342a4ba86e18f2e790c69c6cfc7e1]/xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/util/RNLog.kt?lines=93-95) returned false.
5. **After the themed react context fix,** RNLog.w() dispatches a [native -> javascript call](https://github.com/facebook/react-native/blob/44f9371f246932215627a7ea01fbedf5c13e3019/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/util/RNLog.kt#L94). This renders a LogBox.
6. LogBox renders a <Image/>, which re-starts this loop.

We're not sure what the right long-term solution here is. But, I will follow up! But, until then, it's important that we unblock the ThemedReactContext fix.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D56970919
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D56970919

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in d94c4c4.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label May 16, 2024
Copy link

This pull request was successfully merged by @RSNara in d94c4c4.

When will my fix make it into a release? | How to file a pick request?

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. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants