fix(icons): list icon logic

This commit is contained in:
yusing
2025-10-11 13:07:50 +08:00
parent 14ec80c883
commit ac8ad149b8

View File

@@ -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()