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

Apollo refetchQueries integration? #66

Closed
james-ff opened this issue Mar 8, 2020 · 3 comments
Closed

Apollo refetchQueries integration? #66

james-ff opened this issue Mar 8, 2020 · 3 comments

Comments

@james-ff
Copy link

james-ff commented Mar 8, 2020

How might this library's generated code plug into Apollo's refetchQueries?

https://www.apollographql.com/docs/react/data/mutations/#options

@piglovesyou
Copy link
Owner

@james-ff Hi. Query document exports DocumentNode named ${QueryName}Document that you can make use of it.

import { ViewerDocument } from '../lib/viewer.graphql'
import { useBlaaMutation } from '../lib/blaa.graphql'

function BlaaButton() {
  const [blaa] = useBlaaMutation({
    refetchQueries: [{ query: ViewerDocument }]
  });

  return <button onClick={() => blaa()}>blaa.</button>
}

Glad to hear if it's okay.

@james-ff
Copy link
Author

james-ff commented Mar 9, 2020

Works! Many Thanks

@james-ff james-ff closed this as completed Mar 9, 2020
@piglovesyou
Copy link
Owner

Good to hear that!

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

2 participants