-
Notifications
You must be signed in to change notification settings - Fork 199
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
feat: add context to query #549
Conversation
Add Context to useAsyncQuery and useLazyAsynQuery. Extended prep function to extract context and forward it to apollo client. This allows context configuration per query, e.g. custom headers.
✅ Deploy Preview for apollo-module canceled.
|
This should enable issue #508 |
this is very useful can it get merged sooner |
Co-authored-by: Daniel Roe <daniel@roe.dev>
This would be very useful for us. Any updates? |
Thanks for merging, much appreciated. |
@Digni @Kevintjuhz It'll be apart of the next minor release (coming shortly). |
Just tested this and it works nicely for my use (setting custom headers from within a global middleware). If I don't - then Is this intended? It feels like it would be useful to make the caching mechanism aware of changes in the newly added context :) The same applies to the Apollo DevTools Chrome extension that can be enabled via |
@gerbenvandijk Can you share where exactly you're setting |
@fosterdouglas const { data } = await useAsyncQuery({
query, // -> for me this is an imported .gql file
cache, // -> true or false
context: {
headers: {} // -> an object with my custom headers
}
}) |
Add Context to useAsyncQuery and useLazyAsynQuery. Extended prep function to extract context and forward it to apollo client. This allows context configuration per query, e.g. custom headers.