apollo-client: Interface query with conditional fragments breaks after v0.8.7
Intended outcome:
I have a query like this in my app:
fragment ItemIndexFragment on Item {
id
name
... on SpecialItem {
field1
field2
}
... on ExtraSpecialItem {
field3
field4
}
}
Expected outcome is that this query just works with a watchQuery
.
Actual outcome:
While upgrading ember-apollo-client to the latest apollo-client (and my app that uses it), I encountered a specific route that broke during the upgrade. The watchQuery
observable’s next
function gets called with data: undefined
and stale: true
. AFAICT, the only thing special about this route is the fact that it is on an Interface type and includes conditional fragments depending on the result type.
If I remove the conditional fragments, the query “works”, except without the data I want.
I was upgrading all the way from v0.6.0. Bisecting with apollo-client versions revealed that the query worked as expected all the way through v0.8.7. At v0.9.0, I encountered https://github.com/apollographql/apollo-client/issues/1336, and with v0.10.1, I experience the described broken behavior.
How to reproduce the issue:
Issue a watchQuery
on a Interface type with a query that includes conditional fragments on the result type.
Unsure if this is related to #1337 but it’s the only thing I could find that seemed like it might be.
Edit: d’oh, updated to reflect that this was a query on an Interface type, not a Union
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 4
- Comments: 20 (18 by maintainers)
Commits related to this issue
- failing test: interface query w/ conditional fragments This is a failing test to demonstrate issue #1363. — committed to bgentry/apollo-client by bgentry 7 years ago
- failing test: interface query w/ conditional fragments This is a failing test to demonstrate issue #1363. — committed to apollographql/apollo-client by bgentry 7 years ago
Thanks guys! @fubhy is on it. I think we can get it fixed pretty soon, so stay tuned!
@helfer is there a work-around in the time being? we are not able to implement pagination because of this issue 😦
@helfer I’m facing this issue😕
What is the current status of this issue? This also blocks quite a few (mission critical) things for us.
Same here. We are trying to roll out a software project which should be in production soon, and we have tight milestones. At this point, we are just trying to use this thing, we can’t really afford to get deep into development.
However, once the rush will over, I hope to share with you some of our additions… but unfortunately, none of them is related to getting the basics to work.
I’d love to but I simply don’t have the bandwidth right now, trying to get a venture off the ground. Sorry I can’t be more helpful.