-
Notifications
You must be signed in to change notification settings - Fork 787
React Apollo V3: graphql breaks when using @include / @skip directive and skip option is true #3367
Comments
I just confirmed this happens only with the HoC API. I added RenderProps and Hooks examples to the test case and those work. |
I guess it has to do with this line:
I would presume |
I tested locally by removing But not sure if it is something that has to be fixed on the |
+1 |
👀 |
I'm having this issue as well (or something very similar to it), except I'm using a rather ancient |
I've been digging in a bit further to this issue today. I've narrowed the issue down to a change between In testing, simply re-adding a try-catch around that one statement has fixed the issues on my end. With that in mind, I think this issue would be more appropriate to be moved from |
I got rid of this error
Setting a default value to the arguments I'm passing to
|
Aha, that's an excellent workaround for the time being! Thanks for sharing. |
Intended outcome:
I expect
graphql
to work as it did withreact-apollo@2
.Actual outcome:
After upgrading to
react-apollo@3
, components that usegraphql
and also use the@include / @skip
directive at a top-level field, break with the following error ifskip
istrue
:How to reproduce the issue:
Here an simplified test case I crafted: https://codesandbox.io/s/react-apollo-v3-skip-test-case-h5bw1
If you downgrade
react-apollo@2.5.8
inside the sandbox, you will notice it works well.To clarify, these conditions have to apply for it to break:
@include
in a top-level field (it doesn't break if it is in a nested field)skip
option is set totrue
Quick peak:
Version
This happens with
react-apollo@3.0.0
, and also with the new, individual packages.The
envinfo
preset seems outdated and doesn't include the new namespaced packages.In the prod setup I got this error, we migrated using the namespaced packages. But was also able to reproduce with the
react-apollo
bundle.The text was updated successfully, but these errors were encountered: