From 08f3fbc1e4c663cfbc35377cd4ef2f0e4eae4875 Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 16 Jul 2024 04:53:01 +0800 Subject: [PATCH] fix sui page locale and theme data caching bug --- sui/api/request.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sui/api/request.go b/sui/api/request.go index fd1834f8d..90d3f1c71 100644 --- a/sui/api/request.go +++ b/sui/api/request.go @@ -114,6 +114,13 @@ func (r *Request) Render() (string, int, error) { if !r.Request.DisableCache() && c.DataCacheTime > 0 && c.CacheStore != "" { data, dataHitCache = c.GetData(dataCacheKey) if dataHitCache { + if locale, ok := data["$locale"].(string); ok { + r.Request.Locale = locale + } + + if theme, ok := data["$theme"].(string); ok { + r.Request.Theme = theme + } log.Trace("[SUI] The page %s data is cached %v file=%s key=%s", r.Request.URL.Path, c.DataCacheTime, r.File, dataCacheKey) } }