Fix cache reset for a page's collections on server live reload
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sun, 22 Mar 2020 12:42:39 +0000 (13:42 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 23 Mar 2020 22:14:39 +0000 (23:14 +0100)
Fixes #7085

hugolib/content_map_page.go
hugolib/page__new.go
hugolib/site.go

index bcab9ffa99da86dfd6a6a322c86af68fc42915d2..5607749c9b6dae2a52c454219ee44f04e60b7a3c 100644 (file)
@@ -797,6 +797,10 @@ type pagesMapBucket struct {
 
        owner *pageState // The branch node
 
+       *pagesMapBucketPages
+}
+
+type pagesMapBucketPages struct {
        pagesInit sync.Once
        pages     page.Pages
 
index 4f8abdde5f53d0855fb709212a26e54806dc70bb..938c13d7c6309d161d83407abb71fbd3c5b115d6 100644 (file)
@@ -93,7 +93,7 @@ func newPageBase(metaProvider *pageMeta) (*pageState, error) {
 }
 
 func newPageBucket(p *pageState) *pagesMapBucket {
-       return &pagesMapBucket{owner: p}
+       return &pagesMapBucket{owner: p, pagesMapBucketPages: &pagesMapBucketPages{}}
 }
 
 func newPageFromMeta(
index 56fa654db4b66d1d2eeeb09c480884fe61116bef..5688b5fac2e5b6c9164a9f3e1f7f4a2bfa440059 100644 (file)
@@ -1492,6 +1492,9 @@ func (s *Site) resetBuildState(sourceChanged bool) {
                s.PageCollections = newPageCollections(s.pageMap)
                s.pageMap.withEveryBundlePage(func(p *pageState) bool {
                        p.pagePages = &pagePages{}
+                       if p.bucket != nil {
+                               p.bucket.pagesMapBucketPages = &pagesMapBucketPages{}
+                       }
                        p.parent = nil
                        p.Scratcher = maps.NewScratcher()
                        return false