Skip to content
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

filter from graphql-anywhere removes __typename thus breaking cache updates. #5363

Closed
lifeiscontent opened this issue Sep 24, 2019 · 3 comments

Comments

@lifeiscontent
Copy link
Contributor

Intended outcome:
filter from graphql-anywhere should filter everything thats not in the document, but also include __typename

Actual outcome:
__typename gets removed from the document, thus breaking the update function in a mutation when running cache.writeData({id: dataIdFromObject(object), data})

How to reproduce the issue:

  1. grab a document that doesn't have __typename specified
  2. run filter on it
  3. notice __typename will be removed from data

Versions
System:
OS: macOS Mojave 10.14.6
Binaries:
Node: 10.16.3 - ~/n/bin/node
Yarn: 1.17.3 - ~/.yarn/bin/yarn
npm: 6.11.2 - /usr/local/bin/npm
Browsers:
Chrome: 77.0.3865.75
Firefox: 68.0
Safari: 13.0
npmPackages:
@apollo/react-common: 3.1.1 => 3.1.1
@apollo/react-components: 3.1.1 => 3.1.1
@apollo/react-hoc: 3.1.1 => 3.1.1
@apollo/react-hooks: 3.1.1 => 3.1.1
@apollo/react-ssr: 3.1.1 => 3.1.1
@apollo/react-testing: 3.1.1 => 3.1.1
apollo-cache: 1.3.2 => 1.3.2
apollo-cache-inmemory: 1.6.3 => 1.6.3
apollo-client: 2.6.4 => 2.6.4
apollo-link: 1.2.13 => 1.2.13
apollo-link-context: 1.0.19 => 1.0.19
apollo-link-error: 1.1.12 => 1.1.12
apollo-link-http: 1.5.16 => 1.5.16
apollo-utilities: 1.3.2 => 1.3.2

@lifeiscontent
Copy link
Contributor Author

CC: @hwillson this is important.

@lifeiscontent
Copy link
Contributor Author

It's a bit of an edge case, but if people can't use the mutationResult as the object to pass dataIdFromObject to getting data from the parent is a last resort.

@dylanwulf
Copy link
Contributor

It looks like the graphql-anywhere package is getting removed in v3: #5159

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants