Skip to content

Commit

Permalink
Fix server panic on i18n file change
Browse files Browse the repository at this point in the history
Fixes #12048
  • Loading branch information
bep committed Feb 17, 2024
1 parent 2d1681d commit 9679443
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion hugolib/hugo_sites_build.go
Expand Up @@ -739,7 +739,6 @@ func (h *HugoSites) processPartial(ctx context.Context, l logg.LevelLogger, conf

case files.ComponentFolderLayouts:
tmplChanged = true
h.init.layouts.Reset()
templatePath := pathInfo.TrimLeadingSlash().PathNoLang()
if !h.Tmpl().HasTemplate(templatePath) {
tmplAdded = true
Expand Down Expand Up @@ -899,6 +898,9 @@ func (h *HugoSites) processPartial(ctx context.Context, l logg.LevelLogger, conf
}

if tmplChanged || i18nChanged {
// TODO(bep) we should split this, but currently the loading of i18n and layout files are tied together. See #12048.
h.init.layouts.Reset()

if err := loggers.TimeTrackfn(func() (logg.LevelLogger, error) {
// TODO(bep) this could probably be optimized to somehow
// only load the changed templates and its dependencies, but that is non-trivial.
Expand Down

0 comments on commit 9679443

Please sign in to comment.