diff --git a/changes/changelog.d/1683.bugfix b/changes/changelog.d/1683.bugfix
new file mode 100644
index 000000000..3475fee3d
--- /dev/null
+++ b/changes/changelog.d/1683.bugfix
@@ -0,0 +1 @@
+Fix an issue where the tracks tab in a library doesn't show any tracks (#1683)
diff --git a/front/src/components/audio/podcast/Table.vue b/front/src/components/audio/podcast/Table.vue
index 2f03f1f97..a2407801f 100644
--- a/front/src/components/audio/podcast/Table.vue
+++ b/front/src/components/audio/podcast/Table.vue
@@ -123,11 +123,6 @@ export default {
artist: this.$pgettext('*/*/*/Noun', 'Artist')
}
}
- },
- methods: {
- updatePage: function (page) {
- this.$emit('page-changed', page)
- }
}
}
diff --git a/front/src/components/audio/track/Table.vue b/front/src/components/audio/track/Table.vue
index f5b82f34d..5b612c6df 100644
--- a/front/src/components/audio/track/Table.vue
+++ b/front/src/components/audio/track/Table.vue
@@ -5,8 +5,9 @@
v-if="search"
v-model="query"
@search="
+ currentPage = 1;
additionalTracks = [];
- fetchData();
+ fetchData('tracks/');
"
/>
@@ -106,10 +107,10 @@
class="ui center aligned basic segment desktop-and-up"
>
@@ -140,15 +141,16 @@
:is-podcast="isPodcast"
/>
@@ -194,10 +196,11 @@ export default {
fetchDataUrl: this.nextUrl,
isLoading: false,
additionalTracks: [],
- query: ''
+ query: '',
+ totalTracks: this.total,
+ currentPage: this.page,
}
},
-
computed: {
allTracks () {
return (this.tracks || []).concat(this.additionalTracks)
@@ -212,7 +215,7 @@ export default {
}
},
created () {
- if (!this.tracks) {
+ if (this.tracks.length === 0) {
this.fetchData('tracks/')
}
},
@@ -224,15 +227,15 @@ export default {
this.isLoading = true
const self = this
const params = _.clone(this.filters)
- const tracksPromise = axios.get(url, { params: params })
- params.page_size = this.limit
- params.page = this.page
+ params.page_size = this.paginateBy
+ params.page = this.currentPage
params.include_channels = true
+ params.q = this.query
+ const tracksPromise = await axios.get(url, { params: params })
try {
- await tracksPromise
- self.nextPage = tracksPromise.data.next
- self.objects = tracksPromise.data.results
- self.count = tracksPromise.data.count
+ self.fetchDataUrl = tracksPromise.data.next
+ self.additionalTracks = tracksPromise.data.results
+ self.totalTracks = tracksPromise.data.count
self.$emit('fetched', tracksPromise.data)
self.isLoading = false
} catch (e) {
@@ -241,7 +244,12 @@ export default {
}
},
updatePage: function (page) {
- this.$emit('page-changed', page)
+ if (this.tracks.length === 0) {
+ this.currentPage = page
+ this.fetchData('tracks/')
+ } else {
+ this.$emit('page-changed', page)
+ }
}
}
}
diff --git a/front/src/views/library/DetailTracks.vue b/front/src/views/library/DetailTracks.vue
index c9dd17bb7..45f55addd 100644
--- a/front/src/views/library/DetailTracks.vue
+++ b/front/src/views/library/DetailTracks.vue
@@ -36,7 +36,7 @@ export default {
TrackTable
},
props: {
- object: { type: String, required: true },
+ object: { type: [Object, String], required: true },
isOwner: { type: Boolean, required: true }
}
}