-
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
[3.0 beta-43]: reFetchObservableQueries causes skipped query to be fetched #6154
Comments
This is affecting me as well, I arrived at the same conclusion as op, reFetchObservableQueries is not respecting the skip options. The official guide here recommends calling possibly related issues: |
Yep, broken. See apollographql/react-apollo#3492 (comment). |
I noticed that |
Appears to have been caused by #6999 which was intended to fix #6796 What I don't understand is the use case/motivation behind #6796 in the first place. Why would you want to |
We have some logic that checks which workspace a user is when navigating through our app:
If no workspace can be found, it's skipped.
If the user is anonymous and navigates elsewhere and decides to login, we clear the cache and refetch queries:
Doing this re-executes the query to check the workspace. However, at that point the "skip" logic is ignored and the query fails because there is no workspace in the context, causing the workspace ID to be null. Therefore we get the following error:
"[GraphQL error]: Message: Field 'id' of variable 'id' has coerced Null value for NonNull type 'ID!', Location: [{"line":1,"column":19}], Path: undefined
Intended outcome:
Ideally only non-skipped queries would be re-executed, or the skip logic would be re-run somehow (a callback function for "skip" perhaps ?). This doesn't seem to be happening.
*Actual outcome:
"reFetchObservableQueries" is refetching all queries, regardless of whether they should be skipped or not.
How to reproduce the issue:
I'm working on some reproduction code.
Versions
System:
OS: macOS 10.15.4
Binaries:
Node: 12.14.1 - ~/.nvm/versions/node/v12.14.1/bin/node
Yarn: 1.22.0 - ~/.nvm/versions/node/v12.14.1/bin/yarn
npm: 6.13.4 - ~/.nvm/versions/node/v12.14.1/bin/npm
Browsers:
Chrome: 81.0.4044.92
Firefox: 75.0
Safari: 13.1
npmPackages:
@apollo/client: ^3.0.0-beta.43 => 3.0.0-beta.43
@apollo/link-batch-http: ^2.0.0-beta.3 => 2.0.0-beta.3
@apollo/link-context: ^2.0.0-beta.3 => 2.0.0-beta.3
@apollo/link-error: ^2.0.0-beta.3 => 2.0.0-beta.3
@apollo/react-common: ^4.0.0-beta.1 => 4.0.0-beta.1
@apollo/react-components: ^4.0.0-beta.1 => 4.0.0-beta.1
@apollo/react-hoc: ^4.0.0-beta.1 => 4.0.0-beta.1
@apollo/react-ssr: ^4.0.0-beta.1 => 4.0.0-beta.1
apollo-link-log: ^1.1.3 => 1.1.3
apollo-server: ^2.11.0 => 2.11.0
react-apollo: ^3.1.3 => 3.1.3
The text was updated successfully, but these errors were encountered: