-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Having fragments in a query causes fetchMore to not update the component #1379
Comments
By the way I don't know exactly what causes this problem, so not sure if this belongs here or in react-apollo. I also noticed that when calling |
Ok so I've looked in to this a bit more and it turns out that the issue is somehow caused by the union type. If I set up my API to only return stories and I remove the When upgrading to RC2, calling refetch twice causes it to update the component but it's behind one query then. (So if I start with 8 results, pressing refetch twice causes it to update to have 16, but there are 24 in the store then). |
Small correction: it only works if all the types have the same property, so if I only fetch the ID's on stories, videos and galleries it works fine. But when I add This is illustrated by logging the props in the render method & logging 'updateQuery' in the |
This seems to be related to #1363, but I'm not sure. If so, please feel free to close this. :) |
I think it may be related to #1363. When does the error not occur in your query? Also, fun fact. You could simplify your query like this by removing the inline fragments: query feed($page: Int, $type: String, $search: String) {
feed(count: 8, page: $page, type: $type, search: $search) {
pagination {
total
next_page
}
items {
id,
feedable {
...StoryDetail
...VideoDetail
...GalleryDetail
}
}
}
} I assume that your |
@calebmer there's never really an error, just a wrong order of executing things like I illustrated with the And thanks for the tip about removing the extra |
Fixing #1523 fixes this too. 👍 |
Okay so I'm running in a weird issue. I am using the
fetchMore
method to implement a simple pagination and that works fine. But then I started moving bits of the query in to fragments and it broke. After investigating this I found that the query itself is executed fine, with the right fragments and parameters. The server also has no problems to return the data just like expected. And with the devtools I can also confirm that the data is being added to the store. The weird thing is that it just doesn't seem to update my component. Neither therender
method nor thecomponentWillReceiveProps
is called.This is my fetchMore method on my (React) component.
And this is the query & options.
The text was updated successfully, but these errors were encountered: