Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2346>
environments/review-docs-fix-d-jlladr/deployments/17321
Kasper Seweryn 2023-01-28 23:45:15 +01:00 zatwierdzone przez Georg krause
rodzic 49be19c8b4
commit 9552fcd9a9
2 zmienionych plików z 13 dodań i 5 usunięć

Wyświetl plik

@ -174,7 +174,12 @@ export const useQueue = createGlobalState(() => {
await playNext(true)
}
tracks.value.splice(index, 1)
if (isShuffled.value) {
tracks.value.splice(tracks.value.indexOf(shuffledIds.value[index]), 1)
shuffledIds.value.splice(index, 1)
} else {
tracks.value.splice(index, 1)
}
if (index <= currentIndex.value) {
currentIndex.value -= 1
@ -239,8 +244,12 @@ export const useQueue = createGlobalState(() => {
// Reorder
const reorder = (from: number, to: number) => {
const [id] = tracks.value.splice(from, 1)
tracks.value.splice(to, 0, id)
const list = isShuffled.value
? shuffledIds
: tracks
const [id] = list.value.splice(from, 1)
list.value.splice(to, 0, id)
const current = currentIndex.value
if (current === from) {

Wyświetl plik

@ -111,7 +111,6 @@ export const useTracks = createGlobalState(() => {
// Preload next track
const { start: startPreloadTimeout } = useTimeoutFn(async (index) => {
console.log('@@@@', index)
const { queue } = useQueue()
const sound = await createSound(queue.value[index as number])
await sound.preload()
@ -170,7 +169,7 @@ export const useTracks = createGlobalState(() => {
// NOTE: Preload next track
// Calling this function clears previous timeout and starts a new one.
// Since this watchEffect fires whenever currentIndex / nextTrack changes, it will automatically cleanup previous preload.
// @ts-expect-error vueuse is wrongly typed?
// @ts-expect-error vueuse is wrongly typed: https://github.com/vueuse/vueuse/issues/2691
startPreloadTimeout(currentIndex.value + 1)
})