From 10d4c1156b01bbf2f34c6206c052a6ae134648d4 Mon Sep 17 00:00:00 2001 From: Maksim Totmin Date: Wed, 17 Jun 2026 13:22:05 +0700 Subject: [PATCH] fix: imageCache key includes targetSize/faScale; Alpine color input error breaks x-if rendering --- page.go | 17 +++++++++++------ static/index.html | 3 ++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/page.go b/page.go index 2b8fd34..be07a2e 100644 --- a/page.go +++ b/page.go @@ -415,7 +415,7 @@ func (pm *PageManager) renderKeyOutput(idx int, d *config.DisplayCfg, output str } if do.Text == "" && bgOverride == nil { - return + do = &DisplayOutput{} } pm.displayMu.Lock() @@ -786,8 +786,13 @@ func parseEmojiRef(path string) (rune, error) { return r, nil } +func cacheKey(path string, targetSize int, faScale float64) string { + return fmt.Sprintf("%s|%d|%.6f", path, targetSize, faScale) +} + func loadImage(path string, targetSize int, faScale float64) (image.Image, error) { - if cached, ok := imageCache.Load(path); ok { + key := cacheKey(path, targetSize, faScale) + if cached, ok := imageCache.Load(key); ok { return cached.(image.Image), nil } @@ -800,7 +805,7 @@ func loadImage(path string, targetSize int, faScale float64) (image.Image, error if err != nil { return nil, err } - imageCache.Store(path, img) + imageCache.Store(key, img) return img, nil } @@ -810,7 +815,7 @@ func loadImage(path string, targetSize int, faScale float64) (image.Image, error return nil, err } img := renderEmojiGlyph(r, targetSize, faScale) - imageCache.Store(path, img) + imageCache.Store(key, img) return img, nil } @@ -830,7 +835,7 @@ func loadImage(path string, targetSize int, faScale float64) (image.Image, error if err != nil { return nil, err } - imageCache.Store(path, img) + imageCache.Store(key, img) return img, nil } @@ -845,7 +850,7 @@ func loadImage(path string, targetSize int, faScale float64) (image.Image, error return nil, fmt.Errorf("decode: %w", err) } - imageCache.Store(path, img) + imageCache.Store(key, img) return img, nil } diff --git a/static/index.html b/static/index.html index 83a1272..995a608 100644 --- a/static/index.html +++ b/static/index.html @@ -505,7 +505,8 @@
-