-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Modern] <QueryRenderer> is never rendered with props after successful fetch (Android React Native) #1797
Comments
Verified that relayPayload.source is properly populated in RelayNetwork.js:70 (in the case of "correct fetch, no render" that we're trying to solve). |
Verified that there are no payloads to commit after a successful fetch, at the top of RelayPublishQueue.commitPayloads. |
Very weird behavior - this._pendingPayloads does get initialized, but in With the debugger attached, |
Verified that (only without debugger attached and on Android) _pendingPayloads is not initialized correctly. This code prints "undefined" in that case, "0" in all others:
|
Edit: found a check-in for core-js that fixes this bug. @josephsavona Joe, this line in RelayPublishQueue.js is creating different objects in the "RN Android with no debugger attached" case vs all other cases (iOS or no debugger).
In the correct case it creates an object with a _c field which is a Set. In this case the .size getter works as expected. In the incorrect case the _c field is an Object,
Going deeper, _collection.js in core-js/library/modules provides a size function in the good case, and does not in the bad case. I'm getting pretty deep in the weeds here, can you shed light on why .size is Thanks a lot for your help. |
Ok - RN docs re: JavaScript environment specify that Chrome debugging is a different execution environment from Android when not debugging. That must mean something about my Android environment is causing Is it possible a different version of JavaScriptCore is running in Android and so I get different Set setup behavior? I would def like a solution that will not break for some of my users on certain versions of Android! |
Fixed by adding this polyfill. Took 5 hours of investigation to figure out why Android just doesn't work in Relay Modern 1.0.0, so will submit an update to the docs. |
Relay just didn't work on Android for me. My investigation here: facebook#1797 Solution was posted here: facebook#1704 (comment) I think this is an invaluable warning to save other early adopters hours trying to dig into Relay Modern source and debug this issue. Thanks.
Hmm. There shouldn't be anything special about Relay and Set. If there is, we should fix it asap rather than add a warning. |
Cc @leebyron (Joseph wanted to mention you not some other github's |
From #1704 thanks to @gusbicalho. I added the following to my index.android.js before the AppRegistry. This fixed my props issue and got the props getting rendered correctly.
|
@leebyron @kassens To summarize: Relay Modern doesn't work with React Native on Android Possible fixes:
core-js hasn't released a new version since summer 2016 so I don't think this can be fixed with a new version of that lib. |
Closing since @leebyron indicated: "Set polyfill will no longer be included in the next release." |
I have this problem on a new react native project. Adding the script above does not work. Any ideas? |
Fetch
succeeds, graphql response is properly formed, andrender()
is called after the fetch as expected - butprops
is always null. So the Loading UI displays perpetually.Note that when we attach the debugger, props does get filled - making this a pretty bad Heisenbug for us. App also works perfectly in iOS, just not Android without a debugger.
How can we determine why
props
is not loaded? Is there some kind of race condition that can occur, and attaching the debugger slows things down enough for props to be loaded?The text was updated successfully, but these errors were encountered: