make sure to always update itemForID maps for focus traversal

This commit is contained in:
Drew Weymouth
2024-02-17 08:22:21 -08:00
parent bc113e404d
commit a46b9559bf
3 changed files with 8 additions and 8 deletions
+6 -6
View File
@@ -289,18 +289,18 @@ func (g *GridView) doUpdateItemCard(itemIdx int, card *GridViewItem) {
if itemIdx < len(g.items) {
item = g.items[itemIdx]
}
card.Cover.Im.CenterIcon = g.Placeholder
if !card.NeedsUpdate(item) && card.ItemIndex == itemIdx {
// nothing to do
g.stateMutex.Unlock()
return
}
// update itemForIndex map
if c, ok := g.itemForIndex[card.ItemIndex]; ok && c == card {
delete(g.itemForIndex, card.ItemIndex)
}
card.ItemIndex = itemIdx
g.itemForIndex[itemIdx] = card
card.Cover.Im.CenterIcon = g.Placeholder
if !card.NeedsUpdate(item) && card.ItemIndex == itemIdx {
// nothing to do
g.stateMutex.Unlock()
return
}
g.stateMutex.Unlock()
card.Update(item)
card.ImgLoader.Load(item.CoverArtID)