Skip to content

Commit

Permalink
Don't recreate library row if it already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
1hitsong committed Dec 7, 2023
1 parent fc8e80d commit d004174
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions components/home/HomeRows.bs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,11 @@ sub createLibraryRow()

sectionName = tr("My Media")

' We don't refresh library data, so if section already exists, exit
if sectionExists(sectionName)
return
end if

row = CreateObject("roSGNode", "HomeRow")
row.title = sectionName
row.imageWidth = homeRowItemSizes.WIDE_POSTER[0]
Expand All @@ -277,19 +282,6 @@ sub createLibraryRow()
row.appendChild(item)
end for

' Row already exists, replace it with new content
if sectionExists(sectionName)
m.top.content.replaceChild(row, getSectionIndex(sectionName))

' Reset focus to item within the row, if it was previous highlighted
if m.top.rowItemFocused[0] = getSectionIndex(sectionName)
m.top.jumpToRowItem = [m.top.rowItemFocused[0], m.top.rowItemFocused[1]]
end if

setRowItemSize()
return
end if

' Row does not exist, insert it into the home view
m.top.content.insertChild(row, getOriginalSectionIndex("smalllibrarytiles"))
setRowItemSize()
Expand Down

0 comments on commit d004174

Please sign in to comment.