next-drupal icon indicating copy to clipboard operation
next-drupal copied to clipboard

Add invalidate path hook

Open dottodot opened this issue 2 years ago • 6 comments

This adds a hook after successful on-demand revalidation. This is useful if you then need to clear a cache such as cloudfront.

dottodot avatar Apr 04 '22 09:04 dottodot

Someone is attempting to deploy a commit to the Chapter Three Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Apr 04 '22 09:04 vercel[bot]

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/chapter-three/next-drupal/FcKTFkRhg2Xt6uvxDEJHS1J6zXvA
✅ Preview: Canceled

vercel[bot] avatar Apr 04 '22 11:04 vercel[bot]

I like this. I can definitely see this being useful.

However, since the revalidation API is still experimental in Next.js, I'd like to let this sit for a while and decide on how best to approach this.

Do we want hooks or events? Should we use a plugin system?

<?php

class ArticleRevalidation extends RevalidationBase {

    function preValidation();

    function postValidation();

}

What do you think?

shadcn avatar Apr 04 '22 11:04 shadcn

I think Events is better since we are on Drupal 9.x at the moment.

theodorosploumis avatar Apr 04 '22 11:04 theodorosploumis

Could this be revisited now that revalidation API is stable?

dottodot avatar Jul 14 '22 15:07 dottodot

@dottodot Definitely. Thanks for the ping. I'll start looking into this.

shadcn avatar Jul 14 '22 16:07 shadcn

@shadcn Has there been any progress on this or decision on a route to take. Can always submit a new pr using the preferred approach if not.

dottodot avatar Nov 02 '22 17:11 dottodot

@dottodot Yes. I've implemented a plugin + event subscribers for handling revalidation. WIP here: https://github.com/chapter-three/next-drupal/pull/301

I'll push to a dev release and we can test it.

shadcn avatar Nov 03 '22 15:11 shadcn