Skip to content

Commit

Permalink
fix: folder order is not really based on folderId
Browse files Browse the repository at this point in the history
Signed-off-by: Wolfgang <[email protected]>
  • Loading branch information
wofferl authored and Grotax committed Nov 7, 2024
1 parent 1d6ad90 commit f1485d0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/components/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -485,15 +485,19 @@ export default Vue.extend({
const feedIndex = this.navFeeds.findIndex((it) => it.id === Number(this.$route.params.feedId))
return direction === 'prev' ? feedIndex - 1 : feedIndex + 1
} else {
const folder = this.navFolder.find((folder: Folder) => this.isActiveFolder(folder))
if (!folder) {
return -1
}
// get current folder index
const folderIndex = this.getFolderIndex(direction)
// search for the nearest feed
if (direction === 'next') {
return this.navFeeds.findIndex((it) => it.folderId >= folder.id)
return this.navFeeds.findIndex((feed) => {
const feedFolderIndex = this.navFolder.findIndex(folder => folder.id === feed.folderId)
return feedFolderIndex >= folderIndex - 1
})
} else {
return this.navFeeds.findLastIndex((it) => it.folderId < folder.id)
return this.navFeeds.findLastIndex((feed) => {
const feedFolderIndex = this.navFolder.findIndex(folder => folder.id === feed.folderId)
return feedFolderIndex <= folderIndex
})
}
}
},
Expand Down

0 comments on commit f1485d0

Please sign in to comment.