@@ -208,22 +208,31 @@ export class NetlifyCacheHandler implements CacheHandler {
208
208
}
209
209
210
210
// eslint-disable-next-line @typescript-eslint/no-explicit-any
211
- async revalidateTag ( tag : string , ...args : any ) {
212
- console . debug ( 'NetlifyCacheHandler.revalidateTag' , tag , args )
211
+ async revalidateTag ( tagOrTags : string | string [ ] , ...args : any ) {
212
+ console . debug ( 'NetlifyCacheHandler.revalidateTag' , tagOrTags , args )
213
+
214
+ const tags = Array . isArray ( tagOrTags ) ? tagOrTags : [ tagOrTags ]
213
215
214
216
const data : TagManifest = {
215
217
revalidatedAt : Date . now ( ) ,
216
218
}
217
219
218
- try {
219
- await this . blobStore . setJSON ( await this . encodeBlobKey ( tag ) , data )
220
- } catch ( error ) {
221
- console . warn ( `Failed to update tag manifest for ${ tag } ` , error )
222
- }
220
+ await Promise . all (
221
+ tags . map ( async ( tag ) => {
222
+ try {
223
+ await this . blobStore . setJSON ( await this . encodeBlobKey ( tag ) , data )
224
+ } catch ( error ) {
225
+ console . warn ( `Failed to update tag manifest for ${ tag } ` , error )
226
+ }
227
+ } ) ,
228
+ )
223
229
224
- purgeCache ( { tags : [ tag ] } ) . catch ( ( error ) => {
230
+ purgeCache ( { tags } ) . catch ( ( error ) => {
225
231
// TODO: add reporting here
226
- console . error ( `[NetlifyCacheHandler]: Purging the cache for tag ${ tag } failed` , error )
232
+ console . error (
233
+ `[NetlifyCacheHandler]: Purging the cache for tags ${ tags . join ( ', ' ) } failed` ,
234
+ error ,
235
+ )
227
236
} )
228
237
}
229
238
0 commit comments