Fix fetching pages of albums in album detail view
This commit is contained in:
parent
150eb2a11c
commit
60ae29a612
|
@ -0,0 +1 @@
|
||||||
|
Fix fetching pages of albums in album detail view (#1927)
|
|
@ -138,7 +138,7 @@ if (props.tracks === undefined) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const updatePage = (page: number) => {
|
const updatePage = (page: number) => {
|
||||||
if (props.tracks.length === 0) {
|
if (props.tracks === undefined) {
|
||||||
currentPage.value = page
|
currentPage.value = page
|
||||||
fetchData()
|
fetchData()
|
||||||
} else {
|
} else {
|
||||||
|
@ -234,7 +234,7 @@ const updatePage = (page: number) => {
|
||||||
|
|
||||||
<track-row
|
<track-row
|
||||||
v-for="(track, index) in allTracks"
|
v-for="(track, index) in allTracks"
|
||||||
:key="track.id + (track.position ?? 0)"
|
:key="`${track.id} ${track.position}`"
|
||||||
:data-track-id="track.id"
|
:data-track-id="track.id"
|
||||||
:data-track-position="track.position"
|
:data-track-position="track.position"
|
||||||
:track="track"
|
:track="track"
|
||||||
|
@ -256,7 +256,7 @@ const updatePage = (page: number) => {
|
||||||
>
|
>
|
||||||
<pagination
|
<pagination
|
||||||
:total="totalTracks"
|
:total="totalTracks"
|
||||||
:current="tracks.length > 0 ? page : currentPage"
|
:current="tracks !== undefined ? page : currentPage"
|
||||||
:paginate-by="paginateBy"
|
:paginate-by="paginateBy"
|
||||||
@update:current="updatePage"
|
@update:current="updatePage"
|
||||||
/>
|
/>
|
||||||
|
@ -296,7 +296,7 @@ const updatePage = (page: number) => {
|
||||||
v-if="paginateResults && totalTracks > paginateBy"
|
v-if="paginateResults && totalTracks > paginateBy"
|
||||||
:paginate-by="paginateBy"
|
:paginate-by="paginateBy"
|
||||||
:total="totalTracks"
|
:total="totalTracks"
|
||||||
:current="tracks.length > 0 ? page : currentPage"
|
:current="tracks !== undefined ? page : currentPage"
|
||||||
:compact="true"
|
:compact="true"
|
||||||
@update:current="updatePage"
|
@update:current="updatePage"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -5,6 +5,7 @@ import LibraryWidget from '~/components/federation/LibraryWidget.vue'
|
||||||
import ChannelEntries from '~/components/audio/ChannelEntries.vue'
|
import ChannelEntries from '~/components/audio/ChannelEntries.vue'
|
||||||
import TrackTable from '~/components/audio/track/Table.vue'
|
import TrackTable from '~/components/audio/track/Table.vue'
|
||||||
import PlayButton from '~/components/audio/PlayButton.vue'
|
import PlayButton from '~/components/audio/PlayButton.vue'
|
||||||
|
import Pagination from '~/components/vui/Pagination.vue'
|
||||||
|
|
||||||
interface Events {
|
interface Events {
|
||||||
(e: 'page-changed', page: number): void
|
(e: 'page-changed', page: number): void
|
||||||
|
@ -75,11 +76,19 @@ const getDiscKey = (disc: Track[]) => disc.map(track => track.id).join('|')
|
||||||
:show-art="false"
|
:show-art="false"
|
||||||
:show-album="false"
|
:show-album="false"
|
||||||
:show-artist="false"
|
:show-artist="false"
|
||||||
:paginate-results="true"
|
:paginate-results="false"
|
||||||
:total="totalTracks"
|
/>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="totalTracks > paginateBy"
|
||||||
|
class="ui center aligned basic segment tablet-and-below"
|
||||||
|
>
|
||||||
|
<pagination
|
||||||
|
:current="page"
|
||||||
:paginate-by="paginateBy"
|
:paginate-by="paginateBy"
|
||||||
:page="page"
|
:total="totalTracks"
|
||||||
@page-changed="emit('page-changed', page)"
|
:compact="true"
|
||||||
|
@update:current="(page: number) => emit('page-changed', page)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -95,7 +104,7 @@ const getDiscKey = (disc: Track[]) => disc.map(track => track.id).join('|')
|
||||||
:total="totalTracks"
|
:total="totalTracks"
|
||||||
:paginate-by="paginateBy"
|
:paginate-by="paginateBy"
|
||||||
:page="page"
|
:page="page"
|
||||||
@page-changed="emit('page-changed', page)"
|
@page-changed="(page) => emit('page-changed', page)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="!artist.channel && !isSerie">
|
<template v-if="!artist.channel && !isSerie">
|
||||||
|
|
Loading…
Reference in New Issue