fix: some song lists' filtering were broken (#1865)

This commit is contained in:
Phan An 2024-10-28 15:58:20 +07:00 committed by GitHub
parent 63f2dc5241
commit b4e657686c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 7 deletions

View file

@ -294,7 +294,7 @@ const onPlay = async (playable: Playable) => {
const discIndexMap = computed(() => { const discIndexMap = computed(() => {
const map: { [key: number]: number } = {} const map: { [key: number]: number } = {}
rows.value.forEach((row, index) => { rows.value.forEach((row, index) => {
const { disc } = row.playable const { disc } = row.playable as Song
if (!Object.values(map).includes(disc)) { if (!Object.values(map).includes(disc)) {
map[index] = disc map[index] = disc
} }

View file

@ -29,18 +29,21 @@ import ThumbnailStack from '@/components/ui/ThumbnailStack.vue'
export const useSongList = ( export const useSongList = (
playables: Ref<Playable[]>, playables: Ref<Playable[]>,
context: PlayableListContext = {}, context: PlayableListContext = {},
config: Partial<PlayableListConfig> = { config: Partial<PlayableListConfig> = {},
) => {
const defaultConfig: PlayableListConfig = {
filterable: true, filterable: true,
sortable: true, sortable: true,
reorderable: false, reorderable: false,
collaborative: false, collaborative: false,
hasCustomOrderSort: false, hasCustomOrderSort: false,
}, }
) => {
const filterKeywords = ref('') config = reactive({ ...defaultConfig, ...config })
config = reactive(config)
context = reactive(context) context = reactive(context)
const filterKeywords = ref('')
const { isCurrentScreen, go, url } = useRouter() const { isCurrentScreen, go, url } = useRouter()
const fuzzy = config.filterable const fuzzy = config.filterable

View file

@ -161,7 +161,7 @@ interface Song extends Playable {
album_artist_name: Artist['name'] album_artist_name: Artist['name']
genre: string genre: string
track: number | null track: number | null
disc: number | null disc: number
year: number | null year: number | null
lyrics: string lyrics: string
is_public: boolean is_public: boolean