You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry if this is not the right place for this, but I'm not sure where else to turn to. I'm building an audio-streaming application with React and Redux.js and I want to use this library in my playlist menu component because I want touchscreen support for mobile users, and implementing such myself seems like a nightmare.
The issue
When I pause execution right after consuming from the useSortable hook in my "Item" component, I see that I get an object back for listeners, but it is entirely empty. I've made sure that all of my IDs are unique identifiers, including for the DragOverlay component, I've commented out/removed any logic that could unmount any of these components from the DOM, and I am still running into this issue. Needless to say, I am completely lost at this point.
QueueControl.jsx
exportdefaultfunctionQueueControl(){const[display,setDisplay]=useState(false);const[activeID,setActiveID]=useState(null);constqueue=useSelector(state=>{returnstate.audio.isShuffled ?
state.audio.queue.shuffled
: state.audio.queue.original});// An array containing the numeric IDs of tracks queued up to play// e.g. [1, 2, 3, ...]constcurrentIndex=useSelector(state=>state.audio.currentIndex);conststateTracks=useSelector(state=>state.tracks);// Object with track objects containing their metadata as values under keys corresponding to their ID// e.g. { 8675309: { id: 8675309, title: "867-5309/Jenny", artist: "Tommy Tutone", ... }, ... }constsensors=useSensors(useSensor(PointerSensor),useSensor(KeyboardSensor,{coordinateGetter: sortableKeyboardCoordinates,}),useSensor(MouseSensor))consttracks=useMemo(()=>(queue.slice(currentIndex+1).concat(queue.slice(0,currentIndex))).map(idx=>stateTracks[idx]),[queue,currentIndex,stateTracks])// Array of track objects to pass to each "Item" component// e.g. [ { id: 8675309, title: "867-5309/Jenny", artist: "Tommy Tutone", ... }, ... ]consttoggleDisplay=(e)=>{e.preventDefault();setDisplay(!display);}consthandlePlaylistSave=(e)=>{e.preventDefault();}functionhandleDragStart(e){const{active}=e;setActiveID(active.id);}functionhandleDragEnd(e){const{active, over}=e;if(active.id!==over.id){/* logic to reorder items */}setActiveID(null);}return(<divclassName="queue-control container"><buttonclassName="queue-control button"onClick={toggleDisplay}title="Playlist menu"><iclassName="fa-solid fa-music"/></button><divclassName={/*display ? "queue-control inner hidden" :*/"queue-control inner"}><divclassName="queue-control header"><span>Next Up</span><buttononClick={handlePlaylistSave}>Save Playlist</button></div><ulid="queue-list"><DndContextsensors={sensors}collisionDetection={closestCenter}onDragStart={handleDragStart}onDragEnd={handleDragEnd}><SortableContextitems={tracks}strategy={verticalListSortingStrategy}>{tracks.map((track,idx)=>(<SortableQueueItemkey={idx}track={track}id={track.id}/>))}</SortableContext><DragOverlay>{activeID ?
<QueueItemtrack={tracks[activeID]}id={'overlay'}/>
: null}</DragOverlay></DndContext></ul></div></div>)}
Sorry if this is not the right place for this, but I'm not sure where else to turn to. I'm building an audio-streaming application with React and Redux.js and I want to use this library in my playlist menu component because I want touchscreen support for mobile users, and implementing such myself seems like a nightmare.
The issue
When I pause execution right after consuming from the useSortable hook in my "Item" component, I see that I get an object back for listeners, but it is entirely empty. I've made sure that all of my IDs are unique identifiers, including for the DragOverlay component, I've commented out/removed any logic that could unmount any of these components from the DOM, and I am still running into this issue. Needless to say, I am completely lost at this point.
QueueControl.jsx
SortableQueueItem.jsx
QueueItem.jsx
And this is what is returned from the useSortable hook for listeners:
Any help would be greatly appreciated!
The text was updated successfully, but these errors were encountered: