From 20706fb9a4ec646816b44a10842aa8f58ea0fd75 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Wed, 16 Sep 2026 11:01:02 +0200 Subject: music: play, play next, add to queue The player's queue could only be replaced: every onPlayQueue reset tracks/order/pos together. It becomes one reducer (queue-ops.js) with an `op`, because two appends batched into one tick cannot both read the track count out of separate useStates. A shared pop-up menu (menu.js) carries the three verbs, on right-click and on a dots button. A track row is now a div holding two buttons: a button cannot contain a button. Found by the browser probe: both music wrappers took two arguments and forwarded two, so every "add to queue" arrived as a plain play. Co-Authored-By: Claude Opus 5 --- packages/meshbay-hub/src/meshbay_hub/static/search-page.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'packages/meshbay-hub/src/meshbay_hub/static/search-page.js') diff --git a/packages/meshbay-hub/src/meshbay_hub/static/search-page.js b/packages/meshbay-hub/src/meshbay_hub/static/search-page.js index 3759650..8e3f17c 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/search-page.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/search-page.js @@ -657,9 +657,10 @@ function SearchPage({ token, username, userId, groups, onPlayQueue, userPrefs }) } }, [allEntries, onPlayQueue, connectGroup]); - const handleMusicPlay = useCallback((tracks, startIndex) => { - setVideoEntry(null); - if (onPlayQueue) onPlayQueue(tracks, startIndex); + // Same as group-page.js's wrapper: `op` must be named to survive the hop. + const handleMusicPlay = useCallback((tracks, startIndex, op) => { + if (!op || op === 'replace') setVideoEntry(null); + if (onPlayQueue) onPlayQueue(tracks, startIndex, null, op); }, [onPlayQueue]); const downloadForModal = useCallback(async (entry) => { -- cgit v1.2.3