From 78854bbae39bdeb61eb7d6c467db4b0b6b688097 Mon Sep 17 00:00:00 2001 From: wvffle Date: Tue, 1 Nov 2022 21:24:23 +0000 Subject: [PATCH] Fix tracks table fetching all tracks in some cases --- front/src/components/audio/track/Table.vue | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/front/src/components/audio/track/Table.vue b/front/src/components/audio/track/Table.vue index 7835945b3..f9faaba8b 100644 --- a/front/src/components/audio/track/Table.vue +++ b/front/src/components/audio/track/Table.vue @@ -20,7 +20,7 @@ interface Events { } interface Props { - tracks?: Track[] + tracks?: undefined | Track[] showAlbum?: boolean showArtist?: boolean @@ -47,7 +47,7 @@ interface Props { const emit = defineEmits() const props = withDefaults(defineProps(), { - tracks: () => [], + tracks: undefined, showAlbum: true, showArtist: true, @@ -87,7 +87,7 @@ const additionalTracks = ref([] as Track[]) const query = ref('') const allTracks = computed(() => { - const tracks = [...props.tracks, ...additionalTracks.value] + const tracks = [...(props.tracks ?? []), ...additionalTracks.value] return props.unique ? uniqBy(tracks, 'id') : tracks @@ -133,7 +133,7 @@ const performSearch = () => { fetchData() } -if (props.tracks.length === 0) { +if (props.tracks === undefined) { fetchData() } @@ -251,12 +251,12 @@ const updatePage = (page: number) => { />
@@ -289,7 +289,7 @@ const updatePage = (page: number) => { :is-podcast="isPodcast" />