Intended outcome:
I'm fetching a query like this:
let headers;
if (logged) {
headers = {
authorization: `Bearer test`
};
}
const { data } = useQuery(QUERY, {
context: {
headers
}
});
I was hoping that when I changed the headers of the request a refetch would happen, but I'm getting the previous cached response instead.
So I thought that by doing client.clearStore() before changing the logged flag would result in the cache being cleared and a fresh network request to be sent.
Actual outcome:
A new network request is being sent and completed successfully, however the data property of the response comes with the value undefined.
How to reproduce the issue:
Sandbox
Possibly a dupe of #6044 and discussed here https://github.com/apollographql/apollo-client/issues/6359? My approach to this was creating a whole new client upon these sorts of logged in / logged out state changes. So not sure what is the use of clearStore().
Most helpful comment
Possibly a dupe of #6044 and discussed here https://github.com/apollographql/apollo-client/issues/6359? My approach to this was creating a whole new client upon these sorts of logged in / logged out state changes. So not sure what is the use of
clearStore().