fix(queue): stop claiming a queue came from somewhere it no longer does
`q.source` was written by SetQueue and cleared in exactly one place, Clear, so no append path touched it: adding a track to a queue built from an album left the page still offering "Playing from <that album>", and since the source is persisted alongside the queue state the wrong label outlived the session that earned it. Every add and insert path drops it now. Removing and reordering deliberately do not — a queue with a track taken out of it is still that album, and the link still goes somewhere true. Only the arrival of a track from elsewhere makes the claim false. The delta event carries the source for the same reason it carries the current index: an append emits nothing else, so the frontend would keep the label it was last given until something forced a full state. Closes #14 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -57,6 +57,12 @@ interface TracksModified {
|
||||
index: number;
|
||||
positions?: number[];
|
||||
currentIndex: number;
|
||||
/** The queue's source *after* the mutation. An append clears it
|
||||
* backend-side — a queue built from one album is not that album
|
||||
* once a track from elsewhere joins it — and this delta is the
|
||||
* only event those paths emit, so the label would otherwise keep
|
||||
* pointing at a collection the queue no longer holds. */
|
||||
source?: QueueSource;
|
||||
}
|
||||
|
||||
type Subscriber = () => void;
|
||||
@@ -198,6 +204,7 @@ class QueueStore {
|
||||
}
|
||||
|
||||
this.state.currentIndex = delta.currentIndex;
|
||||
this.state.source = delta.source ?? EMPTY_QUEUE_SOURCE;
|
||||
}
|
||||
|
||||
// ===================================================================
|
||||
|
||||
Reference in New Issue
Block a user