Repository: gohugoio/hugo (language: go)

Issue:
One TailwindCSS related server rebuild issue
I can reproduce this easily, so shoul be easy to fix. What happens in this TW4 site is:

* Editing non TW related things (templates, content) => snappy refreshes.
* Edit TW stylesheet => relatively slow rebuild (Tailwind)
* Then editing non TW related things (templates, content) => seems to keep on rebuilding TW, which should not be needed.

I'm not sure what's happening, or where, but this seem to be something new.


Discussion / hints:

Fix patch:
diff --git a/hugolib/hugo_sites_build.go b/hugolib/hugo_sites_build.go
index 8f3b71bafbb..d862747914a 100644
--- a/hugolib/hugo_sites_build.go
+++ b/hugolib/hugo_sites_build.go
@@ -27,6 +27,7 @@ import (
 
 	"github.com/bep/logg"
 	"github.com/gohugoio/hugo/bufferpool"
+	"github.com/gohugoio/hugo/cache/dynacache"
 	"github.com/gohugoio/hugo/deps"
 	"github.com/gohugoio/hugo/hugofs"
 	"github.com/gohugoio/hugo/hugofs/files"
@@ -1062,6 +1063,18 @@ func (h *HugoSites) processPartialFileEvents(ctx context.Context, l logg.LevelLo
 
 	resourceFiles := h.fileEventsContentPaths(addedOrChangedContent)
 
+	defer func() {
+		// See issue 13316.
+		h.MemCache.DrainEvictedIdentitiesMatching(func(ki dynacache.KeyIdentity) bool {
+			for _, c := range changes {
+				if c.IdentifierBase() == ki.Identity.IdentifierBase() {
+					return true
+				}
+			}
+			return false
+		})
+	}()
+
 	changed := &WhatChanged{
 		needsPagesAssembly: needsPagesAssemble,
 		identitySet:        make(identity.Identities),


Test patch: