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

Fixes #7085
This commit is contained in:
Bjørn Erik Pedersen 2020-03-22 13:42:39 +01:00
parent 244e49c0ea
commit cfa73050a4
3 changed files with 8 additions and 1 deletions

View file

@ -797,6 +797,10 @@ type pagesMapBucket struct {
owner *pageState // The branch node owner *pageState // The branch node
*pagesMapBucketPages
}
type pagesMapBucketPages struct {
pagesInit sync.Once pagesInit sync.Once
pages page.Pages pages page.Pages

View file

@ -93,7 +93,7 @@ func newPageBase(metaProvider *pageMeta) (*pageState, error) {
} }
func newPageBucket(p *pageState) *pagesMapBucket { func newPageBucket(p *pageState) *pagesMapBucket {
return &pagesMapBucket{owner: p} return &pagesMapBucket{owner: p, pagesMapBucketPages: &pagesMapBucketPages{}}
} }
func newPageFromMeta( func newPageFromMeta(

View file

@ -1492,6 +1492,9 @@ func (s *Site) resetBuildState(sourceChanged bool) {
s.PageCollections = newPageCollections(s.pageMap) s.PageCollections = newPageCollections(s.pageMap)
s.pageMap.withEveryBundlePage(func(p *pageState) bool { s.pageMap.withEveryBundlePage(func(p *pageState) bool {
p.pagePages = &pagePages{} p.pagePages = &pagePages{}
if p.bucket != nil {
p.bucket.pagesMapBucketPages = &pagesMapBucketPages{}
}
p.parent = nil p.parent = nil
p.Scratcher = maps.NewScratcher() p.Scratcher = maps.NewScratcher()
return false return false