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

Mutations + DataLoader causes issues #534

Closed
idris opened this issue Nov 3, 2017 · 3 comments
Closed

Mutations + DataLoader causes issues #534

idris opened this issue Nov 3, 2017 · 3 comments

Comments

@idris
Copy link
Contributor

idris commented Nov 3, 2017

I'm trying to upgrade graphql-sequelize to the latest version (using DataLoaders). I have a problem, especially in tests (but can happen in normal cases), where the DataLoader is cached, so the result of the Mutation doesn't show up in future queries.

For example:

  1. do a GraphQL query, which triggers something that gets cached in a DataLoader
  2. do a mutation that affects some data in that query's results
  3. in the output of the mutation, the same DataLoader from step 1 (and step 2) is used, thereby returning stale data. The data was updated in step 2, but the DataLoader still has it cached.

I think we need to call resetCache on dataloader-sequelize each time a new Query/Mutation is issued. But then we also need to call resetCache after any mutation (before it returns any output).

@mickhansen
Copy link
Owner

@idris
Copy link
Contributor Author

idris commented Nov 6, 2017

#536 would also resolve this issue

@bkoltai
Copy link
Contributor

bkoltai commented Nov 30, 2017

So do I understand correctly that the suggested resolution to stale versions of objects being returned from the cache after an update is to disable the dataloader-sequelize always in the resolver options? Or is this in conjunction with some fixes to dataloader-sequelize?

I'm having this same issue but want to continue to benefit from dataload-sequelize for Queries.

Thanks for these great libraries, btw!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants