-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Add ReactMarkerConstants.CONTENT_APPEARED support on Android #43620
Conversation
Base commit: 42f136d |
appreciated if @cortinico could take a look for this pr. |
cc @rubennorte |
b3e2a3e
to
813c6b7
Compare
rebase main to fix conflict |
much appreciated if @rubennorte could help to take a look for this pr |
813c6b7
to
a237918
Compare
if (mJSModuleName != null) { | ||
ReactMarker.logMarker(ReactMarkerConstants.CONTENT_APPEARED, mJSModuleName, mRootViewTag); | ||
} | ||
String jsModuleName = getJSModuleName(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the very late review.
This feels risky because getJSModuleName
asserts, which could introduce new crashes. I understand you changed this so we can override it, but we should either try/catch here or create a new method that doesn't assert and use it instead (and maybe use it to access instead of mJSModuleName
everywhere in this file).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for having the comment. after this pr, mJSModuleName
is only access from the getter.
i was thinking that assertion for getJSModuleName()
could help us catching the issue as early as possible. if we believe that getJSModuleName()
should always be non-nullable. otherwise, if getJSModuleName()
could be nullable, i don't really like try-catch or introducing new method, having an alternative e6a722d change, please let me know which makes more sense to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could help us catching the issue as early as possible
I agree with this when adding a new API, but modifying an API to introduce this, if the previous behavior wasn't crashing, is not ideal.
Given that we already have some callers in the critical path (e.g.: startSurface
) that were using the getter with the assert, I think it might be safe to continue using it, even for this use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright, if that's more toward existing call paths, having try-catch makes more sense than introducing new method.
i've updated the pr to have try-catch. please check again if that makes sense to you. thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I think you misunderstood. I meant that you can keep the implementation you had replacing all usages with getJSModuleName
with the assert because we were already calling that when loading a new surface. If there were cases where it was defined, that should've thrown an error in those cases too. So replacing all with getJSModuleName
and removing the null checks should be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry i was easily mistaken. i've reset the branch to the previous version. hopes that is correct.
56862e0
to
e6a722d
Compare
@@ -28,6 +28,7 @@ public interface ReactRoot { | |||
@Nullable | |||
Bundle getAppProperties(); | |||
|
|||
@Nullable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this @Nullable
annotation and all the new asserts on this diff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated. does the diff look correct now?
packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java
Outdated
Show resolved
Hide resolved
@@ -632,7 +632,7 @@ public void setEventListener(@Nullable ReactRootViewEventListener eventListener) | |||
|
|||
@Override | |||
public String getJSModuleName() { | |||
return Assertions.assertNotNull(mJSModuleName); | |||
return mJSModuleName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we were adding back the assertion. Can you please update this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha it looks like the original version is more correct. sorry i totally misunderstood what you said before.
updated and please let me know if there are any other feedback.
@rubennorte has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding support for this in the new architecture! I'm going to import this at Meta and test it internally before merging.
much appreciated @rubennorte. sorry i spent you a while to address review feedback back-and-forth . |
@rubennorte merged this pull request in 5da9fdf. |
This pull request was successfully merged by @Kudo in 5da9fdf. When will my fix make it into a release? | How to file a pick request? |
This pull request has been reverted by 7e0f894. |
oh no i'm sorry if that cause some breaks in meta internally. let me know if there's anything i can help with. |
Hey, don't worry. It's just one CI job that didn't run correctly in the original PR. I'll re-commit it with the fix today/tomorrow. |
thanks! feel free to let me know if there's anything i can help. |
…ts.CONTENT_APPEARED support on Android" Summary: Changelog: [ANDROID] [ADDED] - Add the ReactMarkerConstants.CONTENT_APPEARED support on Android in bridgeless mode. This re-applies #43620 which was reverted because a CI job started failing because we forgot to update `packages/react-native/ReactAndroid/api/ReactAndroid.api`. Reviewed By: cortinico Differential Revision: D58535868 fbshipit-source-id: 9eec33c5e798850a7434a6c391abf2fc3fc9d0a6
…ts.CONTENT_APPEARED support on Android" Summary: Changelog: [ANDROID] [ADDED] - Add the ReactMarkerConstants.CONTENT_APPEARED support on Android in bridgeless mode. This re-applies #43620 which was reverted because a CI job started failing because we forgot to update `packages/react-native/ReactAndroid/api/ReactAndroid.api`. Reviewed By: cortinico Differential Revision: D58535868 fbshipit-source-id: 9eec33c5e798850a7434a6c391abf2fc3fc9d0a6
Summary:
Add the
ReactMarkerConstants.CONTENT_APPEARED
support on Android in bridgeless mode. This is an important marker for TTI measurement.Changelog:
[ANDROID] [ADDED] - Add the
ReactMarkerConstants.CONTENT_APPEARED
support on Android in bridgeless mode.Test Plan:
adding this on RNTesterActivity to see if the log is executed