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

Support automatic persisted queries #43

Open
shortcircuit3 opened this issue Mar 29, 2020 · 2 comments
Open

Support automatic persisted queries #43

shortcircuit3 opened this issue Mar 29, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@shortcircuit3
Copy link

I’ll be using a go library for the server and I was not sure if this library supported automatic persisted queries

If so, how do I use this functionality?

@jaydenseric
Copy link
Owner

Interesting; at the moment that feature is not supported.

To get it working, we would need to either need to build in support for it (config option, hashing the query, multiple fetch requests per operation), or allow configuring the fetcher for custom implementations.

@jaydenseric jaydenseric added the enhancement New feature or request label Apr 6, 2020
@jaydenseric
Copy link
Owner

The new graphql-react v13 API has composable React hooks for the separate concerns of reading from the cache vs loading it.

A custom hook could be used as an alternative to useLoadGraphQL, that does the persisted queries stuff instead of a single, normal fetch request. Here is the source for inspiration:

module.exports = function useLoadGraphQL() {

If you know for sure the query is persisted and you don't need to make fallback fetch requests, you could just have some sort of hook/function that creates appropriate fetch options for a persisted query to pass into the normal useLoadGraphQL hook.

@jaydenseric jaydenseric changed the title Automatic persisted queries support? Support automatic persisted queries Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants