fix: #2053
Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2346>
This commit is contained in:
parent
026196d698
commit
d3b3463415
|
@ -174,7 +174,12 @@ export const useQueue = createGlobalState(() => {
|
||||||
await playNext(true)
|
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) {
|
if (index <= currentIndex.value) {
|
||||||
currentIndex.value -= 1
|
currentIndex.value -= 1
|
||||||
|
@ -239,8 +244,12 @@ export const useQueue = createGlobalState(() => {
|
||||||
|
|
||||||
// Reorder
|
// Reorder
|
||||||
const reorder = (from: number, to: number) => {
|
const reorder = (from: number, to: number) => {
|
||||||
const [id] = tracks.value.splice(from, 1)
|
const list = isShuffled.value
|
||||||
tracks.value.splice(to, 0, id)
|
? shuffledIds
|
||||||
|
: tracks
|
||||||
|
|
||||||
|
const [id] = list.value.splice(from, 1)
|
||||||
|
list.value.splice(to, 0, id)
|
||||||
|
|
||||||
const current = currentIndex.value
|
const current = currentIndex.value
|
||||||
if (current === from) {
|
if (current === from) {
|
||||||
|
|
|
@ -111,7 +111,6 @@ export const useTracks = createGlobalState(() => {
|
||||||
|
|
||||||
// Preload next track
|
// Preload next track
|
||||||
const { start: startPreloadTimeout } = useTimeoutFn(async (index) => {
|
const { start: startPreloadTimeout } = useTimeoutFn(async (index) => {
|
||||||
console.log('@@@@', index)
|
|
||||||
const { queue } = useQueue()
|
const { queue } = useQueue()
|
||||||
const sound = await createSound(queue.value[index as number])
|
const sound = await createSound(queue.value[index as number])
|
||||||
await sound.preload()
|
await sound.preload()
|
||||||
|
@ -170,7 +169,7 @@ export const useTracks = createGlobalState(() => {
|
||||||
// NOTE: Preload next track
|
// NOTE: Preload next track
|
||||||
// Calling this function clears previous timeout and starts a new one.
|
// 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.
|
// 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)
|
startPreloadTimeout(currentIndex.value + 1)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue