diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-02-17 11:09:09 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-02-17 11:46:45 +0100 |
commit | 9679443c15e734f5b469c61ebf7afa2e000e9cbc (patch) | |
tree | 47f34af929f20075838b39fa1732717ea46f318e | |
parent | 2d1681d915dee33023c662d1cb51b98b35e535da (diff) | |
download | hugo-9679443c15e734f5b469c61ebf7afa2e000e9cbc.tar.gz hugo-9679443c15e734f5b469c61ebf7afa2e000e9cbc.zip |
Fix server panic on i18n file change
Fixes #12048
-rw-r--r-- | hugolib/hugo_sites_build.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/hugolib/hugo_sites_build.go b/hugolib/hugo_sites_build.go index aa43d541a..3a046df3b 100644 --- a/hugolib/hugo_sites_build.go +++ b/hugolib/hugo_sites_build.go @@ -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 @@ -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. |