fix(05-jamtrack): pass jamServer to all loadJamTrack calls
Issue: jamServer was undefined in downloadJamTrack thunk Root cause: One loadJamTrack call in handlePlay was missing jamServer parameter Fix: - Added jamServer to loadJamTrack call on line 194 - Added jamServer to dependency array on line 384 - Removed debug logging All loadJamTrack calls now properly pass jamServer with subscribe/unsubscribe. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
5c1c20c9b8
commit
ed6d006d14
|
|
@ -38,18 +38,13 @@ const JKSessionJamTrackPlayer = ({
|
|||
const [selectedMixdownId, setSelectedMixdownId] = useState(initialMixdownId);
|
||||
|
||||
// Context
|
||||
const context = useJamServerContext();
|
||||
console.log('[JamTrackPlayer] JamServer context:', context);
|
||||
const { subscribe, unsubscribe } = context || {};
|
||||
const { subscribe, unsubscribe } = useJamServerContext();
|
||||
|
||||
// Create jamServer object with subscribe/unsubscribe for thunks
|
||||
const jamServer = useMemo(() => {
|
||||
console.log('[JamTrackPlayer] Creating jamServer with subscribe:', !!subscribe, 'unsubscribe:', !!unsubscribe);
|
||||
return {
|
||||
subscribe,
|
||||
unsubscribe
|
||||
};
|
||||
}, [subscribe, unsubscribe]);
|
||||
const jamServer = useMemo(() => ({
|
||||
subscribe,
|
||||
unsubscribe
|
||||
}), [subscribe, unsubscribe]);
|
||||
|
||||
// Redux state
|
||||
const dispatch = useDispatch();
|
||||
|
|
@ -190,7 +185,8 @@ const JKSessionJamTrackPlayer = ({
|
|||
jamTrack,
|
||||
mixdownId: selectedMixdownId,
|
||||
autoPlay: true,
|
||||
jamClient
|
||||
jamClient,
|
||||
jamServer
|
||||
})).unwrap();
|
||||
} else if (jamTrackState.isPaused) {
|
||||
// Resume from pause
|
||||
|
|
@ -380,7 +376,7 @@ const JKSessionJamTrackPlayer = ({
|
|||
await dispatch(loadJamTrack({ jamTrack, mixdownId: selectedMixdownId, autoPlay: false, jamClient, jamServer }));
|
||||
}
|
||||
}
|
||||
}, [error, isOperating, jamTrack, jamClient, selectedMixdownId, handleRetryDownload, buildFqId, dispatch]);
|
||||
}, [error, isOperating, jamTrack, jamClient, jamServer, selectedMixdownId, handleRetryDownload, buildFqId, dispatch]);
|
||||
|
||||
// Helper: Format milliseconds to MM:SS
|
||||
const formatTime = useCallback((ms) => {
|
||||
|
|
|
|||
|
|
@ -155,12 +155,8 @@ export const downloadJamTrack = createAsyncThunk(
|
|||
// WebSocket gateway will send SUBSCRIPTION_MESSAGE updates
|
||||
// Handler in useSessionWebSocket.js will dispatch setDownloadState updates
|
||||
console.log(`[JamTrack] Subscribing to packaging notifications for package ${packageId}`);
|
||||
console.log('[JamTrack] jamServer:', jamServer);
|
||||
console.log('[JamTrack] jamServer.subscribe:', jamServer?.subscribe);
|
||||
console.log('[JamTrack] jamServer.unsubscribe:', jamServer?.unsubscribe);
|
||||
|
||||
if (!jamServer || !jamServer.subscribe) {
|
||||
console.error('[JamTrack] WebSocket connection not available - jamServer:', jamServer);
|
||||
throw new Error('WebSocket connection not available');
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue