-
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
[question] is there a way to render component on partial query response? #971
Comments
Thanks for asking. You're right that const FooContainer = Relay.createContainer(FooComponent, {
initialVariables: {
isMounted: false,
},
fragments: {
user: () => Relay.QL`
fragment on SomeType {
id # <-- be sure to fetch at least something at first, even just `id` or `__typename`
expensiveField @include(if: $isMounted) # <-- don't fetch at first
... And then in the component's |
Thanks for quick response! It's something to work with, but say if I have five |
Yes, the approach I outlined would return all fields marked as conditional at the same time. A more complete version of what you're describing is the |
yeah..I used the same approach in my project. Glad that I'm using the 'Official' way! the drawback is that we will have lots of boilerplate code which I tried to avoid. I still think that deferred query is the right way to go. I'll keep an close eye on this issue |
Say I have a query with two root fragments:
One of them takes very long to resolve, another resolves very quickly. I would be happy to render the component partially once the graphql response for the first query is there, but instead Relay is waiting for all the data to arrive for first render.
Is there a way to render component on partial query response?
I saw
getFragment().defer()
in the source code, which seems to be accomplishing similar goal, but it's not currently supported in OS version.The text was updated successfully, but these errors were encountered: