fix(orbit): attribute bulk-added tracks to host in queue view

Album and playlist enqueues go through usePlayerStore.enqueue() directly,
never through hostEnqueueToOrbit, so the tracks never land in
state.queue. Our attribution map only covered state.queue entries, so
bulk-added rows rendered with no label at all.

Fall back to "Added by you" when a track is in the host's player queue
but has no state.queue entry — the host added it themselves by
definition (pre-session or bulk-add). The guest-side view already had
this fallback via base.host in useOrbitHost.ts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Psychotoxical
2026-04-25 00:34:00 +02:00
parent a84be98140
commit 6ca678547b
+5 -5
View File
@@ -264,13 +264,13 @@ function QueuePanelHostOrSolo() {
}, [orbitRole, orbitState]); }, [orbitRole, orbitState]);
const orbitHostUsername = orbitState?.host ?? ''; const orbitHostUsername = orbitState?.host ?? '';
/** Attribution label for a queue row / current track while hosting. Null when /** Attribution label for a queue row / current track while hosting. Null when
* not hosting, when the track isn't part of the Orbit state, or when it * not in a hosted session. Bulk-adds (album / playlist enqueue) bypass
* isn't relevant for this user (non-host and we haven't mapped the added-by). */ * `hostEnqueueToOrbit` and therefore never land in `state.queue`, so we
* default those to "Added by you" rather than showing nothing. */
const orbitAttributionLabel = (trackId: string): string | null => { const orbitAttributionLabel = (trackId: string): string | null => {
if (orbitRole !== 'host') return null; if (orbitRole !== 'host' || !orbitState) return null;
const addedBy = orbitAddedByByTrack.get(trackId); const addedBy = orbitAddedByByTrack.get(trackId);
if (!addedBy) return null; if (!addedBy || addedBy === orbitHostUsername) return t('orbit.queueAddedByYou');
if (addedBy === orbitHostUsername) return t('orbit.queueAddedByYou');
return t('orbit.queueAddedByUser', { user: addedBy }); return t('orbit.queueAddedByUser', { user: addedBy });
}; };
const queue = usePlayerStore(s => s.queue); const queue = usePlayerStore(s => s.queue);