Skip to content

Instantly share code, notes, and snippets.

@pieterjandebruyne
pieterjandebruyne / useApolloCache.ts
Last active January 23, 2024 20:52
useApolloCache
import { DocumentNode, useApolloClient } from '@apollo/client';
interface IApolloCacheReturn {
deleteApolloCacheForDocuments: (
documents: Array<DocumentNode>
) => Promise<void>;
}
export const useApolloCache = (): IApolloCacheReturn => {
const client = useApolloClient();
const getQueryNameFromDocument = (document: DocumentNode) => {