Apollo-client: When mixing server and @client queries in the same call fragments don't work in the @client tagged query

Created on 25 Apr 2018  路  7Comments  路  Source: apollographql/apollo-client

Intended outcome:

Fragments work as expected for both the @client tagged query and the non tagged query.

Actual outcome:

The fragment for the @client query will throw an error as it's "defined but not used" even though it's both defined and used. If instead of using a fragment you hardcode the contents of the @client query it behaves as expected.

How to reproduce the issue:

The branch client-fragments on my fork of the reproducer has 4 different commits showing how this issue behaves in different situations. Checking out each commit and running it should show the behavior in each situation.

  • The first reproduces the bug. When checked out and ran the expected result is for an error saying "fragment pets was defined but not used" to be displayed.
  • The second shows how when not mixed, as in there is no @client directive being used, everything behaves as expected. When checked out and run you see the server data in the list.
  • The third shows how when there is just an @client tagged query being used fragments also work just fine. When checked out and run you see only the client side data in the list.
  • The fourth shows how when not using fragments behavior is as expected. When checked out and run you see a mix of server data, the people, and client data, the pets, in the list.

Version

馃毀 in-triage

Most helpful comment

We have changes coming shortly (hopefully within the next week) that will address this.

All 7 comments

Would this be a better fit for an issue in link-state? If so I can move this issue there. Thanks!

Is there any information regarding this? It seems like a serious shortcoming and there hasn't been an update in 5 months.

We have changes coming shortly (hopefully within the next week) that will address this.

Please, tell me that the changes are already out and you just forgot to update this issue status...

I'm pretty sure this is fixed in 2.5, but I can't confirm

@nomadoda looks like you're correct. I've added a new commit that upgrades apollo and the mixed fragments work. I'm going to leave this open for a bit to see if anyone from Apollo team will confirm but it looks like this isn't reproducible anymore.

Thanks for reporting this. There hasn't been any activity here in quite some time, so we'll close this issue for now. If this is still a problem (using a modern version of Apollo Client), please let us know. Thanks!

Was this page helpful?
0 / 5 - 0 ratings