From b4e657686c9335cda3e411f357c40d4abdfef72f Mon Sep 17 00:00:00 2001 From: Phan An Date: Mon, 28 Oct 2024 15:58:20 +0700 Subject: [PATCH] fix: some song lists' filtering were broken (#1865) --- .../js/components/song/song-list/SongList.vue | 2 +- resources/assets/js/composables/useSongList.ts | 13 ++++++++----- resources/assets/js/types.d.ts | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/resources/assets/js/components/song/song-list/SongList.vue b/resources/assets/js/components/song/song-list/SongList.vue index dc4bbe62..b46b98e8 100644 --- a/resources/assets/js/components/song/song-list/SongList.vue +++ b/resources/assets/js/components/song/song-list/SongList.vue @@ -294,7 +294,7 @@ const onPlay = async (playable: Playable) => { const discIndexMap = computed(() => { const map: { [key: number]: number } = {} rows.value.forEach((row, index) => { - const { disc } = row.playable + const { disc } = row.playable as Song if (!Object.values(map).includes(disc)) { map[index] = disc } diff --git a/resources/assets/js/composables/useSongList.ts b/resources/assets/js/composables/useSongList.ts index cd4ad0c3..da5b0362 100644 --- a/resources/assets/js/composables/useSongList.ts +++ b/resources/assets/js/composables/useSongList.ts @@ -29,18 +29,21 @@ import ThumbnailStack from '@/components/ui/ThumbnailStack.vue' export const useSongList = ( playables: Ref, context: PlayableListContext = {}, - config: Partial = { + config: Partial = {}, +) => { + const defaultConfig: PlayableListConfig = { filterable: true, sortable: true, reorderable: false, collaborative: false, hasCustomOrderSort: false, - }, -) => { - const filterKeywords = ref('') - config = reactive(config) + } + + config = reactive({ ...defaultConfig, ...config }) context = reactive(context) + const filterKeywords = ref('') + const { isCurrentScreen, go, url } = useRouter() const fuzzy = config.filterable diff --git a/resources/assets/js/types.d.ts b/resources/assets/js/types.d.ts index 414951e1..69bfd284 100644 --- a/resources/assets/js/types.d.ts +++ b/resources/assets/js/types.d.ts @@ -161,7 +161,7 @@ interface Song extends Playable { album_artist_name: Artist['name'] genre: string track: number | null - disc: number | null + disc: number year: number | null lyrics: string is_public: boolean