From 6ca678547b761afc78fefe89b7d52f146c315ea1 Mon Sep 17 00:00:00 2001 From: Psychotoxical <171614930+Psychotoxical@users.noreply.github.com> Date: Sat, 25 Apr 2026 00:34:00 +0200 Subject: [PATCH] fix(orbit): attribute bulk-added tracks to host in queue view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- src/components/QueuePanel.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/QueuePanel.tsx b/src/components/QueuePanel.tsx index 855c97c7..97140f32 100644 --- a/src/components/QueuePanel.tsx +++ b/src/components/QueuePanel.tsx @@ -264,13 +264,13 @@ function QueuePanelHostOrSolo() { }, [orbitRole, orbitState]); const orbitHostUsername = orbitState?.host ?? ''; /** 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 - * isn't relevant for this user (non-host and we haven't mapped the added-by). */ + * not in a hosted session. Bulk-adds (album / playlist enqueue) bypass + * `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 => { - if (orbitRole !== 'host') return null; + if (orbitRole !== 'host' || !orbitState) return null; const addedBy = orbitAddedByByTrack.get(trackId); - if (!addedBy) return null; - if (addedBy === orbitHostUsername) return t('orbit.queueAddedByYou'); + if (!addedBy || addedBy === orbitHostUsername) return t('orbit.queueAddedByYou'); return t('orbit.queueAddedByUser', { user: addedBy }); }; const queue = usePlayerStore(s => s.queue);