diff --git a/js/actionCreators/index.ts b/js/actionCreators/index.ts index 6fb2fb02..9a351e27 100644 --- a/js/actionCreators/index.ts +++ b/js/actionCreators/index.ts @@ -58,6 +58,7 @@ export { seekBackward, setVolume, playTrack, + playTrackNow, adjustVolume, scrollVolume, setBalance, diff --git a/js/actionCreators/media.ts b/js/actionCreators/media.ts index 4b44d92a..05e37d5d 100644 --- a/js/actionCreators/media.ts +++ b/js/actionCreators/media.ts @@ -31,6 +31,10 @@ export function playTrack(id: number): Thunk { }; } +export function playTrackNow(id: number): Action { + return { type: PLAY_TRACK, id }; +} + export function play(): Thunk { return (dispatch: Dispatch, getState: GetState) => { const state = getState(); diff --git a/js/components/PlaylistWindow/TrackCell.tsx b/js/components/PlaylistWindow/TrackCell.tsx index 7276ed0e..408a0b07 100644 --- a/js/components/PlaylistWindow/TrackCell.tsx +++ b/js/components/PlaylistWindow/TrackCell.tsx @@ -28,7 +28,7 @@ function TrackCell({ children, handleMoveClick, index, id }: Props) { const current = currentTrackId === id; const dispatch = useTypedDispatch(); - const playTrack = useActionCreator(Actions.playTrack); + const playTrackNow = useActionCreator(Actions.playTrackNow); const onMouseDown = useCallback( (e: React.MouseEvent) => { @@ -62,7 +62,7 @@ function TrackCell({ children, handleMoveClick, index, id }: Props) { onClick={(e) => e.stopPropagation()} onMouseDown={onMouseDown} onContextMenu={(e) => e.preventDefault()} - onDoubleClick={() => playTrack(id)} + onDoubleClick={() => playTrackNow(id)} > {children}