Unverified Commit 502e919e authored by Hendrik Liebau's avatar Hendrik Liebau Committed by GitHub

Do not pass an empty string tag into `receiveExpiredTags` (#76561)

Follow-up fix for #76130. This avoids unnecessary calls to the tags
service when no tags are used.
parent 856e2b19
...@@ -1443,7 +1443,7 @@ export default abstract class Server< ...@@ -1443,7 +1443,7 @@ export default abstract class Server<
// cache handlers. // cache handlers.
const handlers = getCacheHandlers() const handlers = getCacheHandlers()
if (handlers) { if (handlers) {
const header = req.headers[NEXT_CACHE_REVALIDATED_TAGS_HEADER] ?? '' const header = req.headers[NEXT_CACHE_REVALIDATED_TAGS_HEADER]
const expiredTags = typeof header === 'string' ? header.split(',') : [] const expiredTags = typeof header === 'string' ? header.split(',') : []
const promises: Promise<void>[] = [] const promises: Promise<void>[] = []
......
...@@ -103,6 +103,15 @@ describe('dynamic-io-cache-handlers', () => { ...@@ -103,6 +103,15 @@ describe('dynamic-io-cache-handlers', () => {
}) })
}) })
it('should call receiveExpiredTags on global default cache handler without tags if none are provided', async () => {
const res = await fetchViaHTTP(appPort, '/', {})
expect(res.status).toBe(200)
await retry(async () => {
expect(output).toContain('symbol receiveExpiredTags []')
})
})
it('should call receiveExpiredTags on global default cache handler', async () => { it('should call receiveExpiredTags on global default cache handler', async () => {
const res = await fetchViaHTTP( const res = await fetchViaHTTP(
appPort, appPort,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment