Skip to content
Permalink
Browse files

Fix cache reset for a page's collections on server live reload

Fixes #7085
  • Loading branch information
bep committed Mar 22, 2020
1 parent 244e49c commit cfa73050a49b2646fe3557cefa0ed31989b0eeeb
Showing with 8 additions and 1 deletion.
  1. +4 −0 hugolib/content_map_page.go
  2. +1 −1 hugolib/page__new.go
  3. +3 −0 hugolib/site.go
@@ -797,6 +797,10 @@ type pagesMapBucket struct {

owner *pageState // The branch node

*pagesMapBucketPages
}

type pagesMapBucketPages struct {
pagesInit sync.Once
pages page.Pages

@@ -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(
@@ -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

0 comments on commit cfa7305

Please sign in to comment.
You can’t perform that action at this time.