Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
blackshibe committed Jun 22, 2022
1 parent 392ba4d commit 0f009e9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/renderer/components/Playlists/Playlist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ const Playlist: React.FC = () => {
const { tracks, trackPlayingId, playerStatus, playlists, currentPlaylist, libraryLayoutSettings } = useSelector(
(state: RootState) => {
const { library, player, playlists } = state;

const { search, tracks } = library;
const filteredTracks = filterTracks(tracks.playlist, search);

const filteredTracks = filterTracks(tracks.playlist, search);
const currentPlaylist = playlists.list.find((p) => p._id === playlistId);

return {
Expand Down
1 change: 1 addition & 0 deletions src/renderer/store/actions/PlaylistsActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const load = async (_id: string): Promise<void> => {
try {
const playlist = await app.db.Playlist.findOneAsync({ _id });
const tracks = await app.db.Track.findAsync({ _id: { $in: playlist.tracks } });

store.dispatch({
type: types.PLAYLISTS_LOAD_ONE,
payload: {
Expand Down
4 changes: 3 additions & 1 deletion src/renderer/store/reducers/library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ const initialState: LibraryState = {
export default (state = initialState, action: Action): LibraryState => {
switch (action.type) {
case types.LIBRARY_REFRESH: {
const prevTracks = state.tracks.playlist;

return {
...state,
tracks: {
library: [...action.payload.tracks],
playlist: [],
playlist: prevTracks,
},
loading: false,
};
Expand Down

0 comments on commit 0f009e9

Please sign in to comment.