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

getCacheKey is missing in operation context #136

Closed
raymondsze opened this issue Aug 21, 2018 · 8 comments

Comments

Projects
None yet
4 participants
@raymondsze
Copy link

commented Aug 21, 2018

As title, the getCacheKey is missing in the context of resolvers. Probably due to version of apollo-client?
I can obtain the getCacheKey if I perform query or mutation by apollo-client instead of dev-tools.

@serranoarevalo

This comment has been minimized.

Copy link

commented Oct 12, 2018

@raymondsze How did you fix this?

@raymondsze

This comment has been minimized.

Copy link
Author

commented Oct 16, 2018

I didn't fix it. I am currently using it like this way.

{
  Mutation: {
      testing(root: {}, args: { id: string, value: string }, { cache }: { cache: InMemoryCache }): TestingMutation['testing'] {
        cache.writeData({
          // once this issue is resolved, here should be changed to cache.getCacheKey instead of dataIdFromObject
          id: cache['config'].dataIdFromObject({
            __typename: TESTING,
            id: args.id,
          }),
          data: { value: string },
        });
        return null;
      },
    },
}
@serranoarevalo

This comment has been minimized.

Copy link

commented Oct 16, 2018

@raymondsze Cheers! Thanks

@justinanastos

This comment has been minimized.

Copy link
Contributor

commented Feb 11, 2019

Thanks for the report! This doesn't appear to be a devtools issue. If I'm mistaken then please comment here and I'll re-open (and ask for a full reproduction).

@moonray

This comment has been minimized.

Copy link

commented Feb 11, 2019

Actually, this does appear to be a problem with devtools; it's not using the same version of apollo-cache-inmemory as whichever react app it's trying to integrate with

@justinanastos justinanastos reopened this Feb 11, 2019

@justinanastos

This comment has been minimized.

Copy link
Contributor

commented Feb 11, 2019

Thanks for responding so quickly @moonray . Can you please help me with a minimal reproduction? https://github.com/apollographql/fullstack-tutorial might be a good jump off point

@justinanastos

This comment has been minimized.

Copy link
Contributor

commented Feb 15, 2019

@moonray Can you share the versions of the packages?

@justinanastos

This comment has been minimized.

Copy link
Contributor

commented Feb 20, 2019

@moonray I tried to reproduce this by installing old versions. I'm going to close this issue until I hear back 🤞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.