A music player that connects to your cloud/distributed storage.
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: clear none-existing items from queue when pool changes

+12 -3
+12 -3
src/components/engine/queue/worker.js
··· 56 56 export function pool(tracks) { 57 57 $lake.value = tracks; 58 58 $poolHash.value = hash(tracks); 59 - 60 - // TODO: Clear the queue, 61 - // there might be items in there that are no longer in the pool. 62 59 } 63 60 64 61 /** ··· 106 103 effect(() => announce("now", $now.value, port)); 107 104 effect(() => announce("past", $past.value, port)); 108 105 effect(() => announce("poolHash", $poolHash.value, port)); 106 + 107 + // Effects 108 + 109 + // When the pool changes, 110 + // make sure all future queue items still exist. 111 + effect(() => { 112 + const existing = new Set($lake.value.map((t) => t.id)); 113 + 114 + $future.value = $future.value.filter((i) => { 115 + return existing.has(i.id); 116 + }); 117 + }); 109 118 }); 110 119 111 120 ////////////////////////////////////////////