From ac8ad149b8b8bfadce30944ba0cc840e3bee8c7d Mon Sep 17 00:00:00 2001 From: yusing Date: Sat, 11 Oct 2025 13:07:50 +0800 Subject: [PATCH] fix(icons): list icon logic --- internal/homepage/list_icons.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/homepage/list_icons.go b/internal/homepage/list_icons.go index 0a19f640..a03d63ce 100644 --- a/internal/homepage/list_icons.go +++ b/internal/homepage/list_icons.go @@ -93,7 +93,7 @@ func (k IconKey) SourceRef() (IconSource, string) { } func InitIconListCache() { - m := iconsCache.Load() + m := make(IconMap) err := serialization.LoadJSONIfExist(common.IconListCachePath, &m) if err != nil { // backward compatible @@ -119,8 +119,11 @@ func InitIconListCache() { } } + iconsCache.Store(m) + task.OnProgramExit("save_icons_cache", func() { - _ = serialization.SaveJSON(common.IconListCachePath, &m, 0o644) + icons := iconsCache.Load() + _ = serialization.SaveJSON(common.IconListCachePath, &icons, 0o644) }) go backgroundUpdateIcons()