How do I invalidate dynamically cache via WPGraphl and Nuxt 3?

I am using a headless WordPress and the frontend in Nuxt 3. In order to interact with WordPress I use GraphQL with WPGraphQL. Additionally, I installed WPGraphQL Cache to generate X-Graphql-Keys. In my frontend I use a custom GraphQL client which is able to cache, get the cache control and so on. The problem comes with dynamic cache invalidation. I need somehome to invalidate the current cache (via Network) when a post is published, edited, removed, etc. As far I know, WPGraphQL use the X-Graphql-Keys in the graph request header (network) and if there is any modification, the keys changes and this is how apparently the WordPress plugin tells via headers that the query content has changed. But, how can I get this keys? They seem to be prodected. Is there another way to do it? I have tried to get the X-GraphlQL keys in Nuxt 3 but I can't even log them out.

Comment (0)

You’ll be in good company