Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/js/components/GridItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { isTouchDevice } from '../util/helpers';
import * as uiActions from '../services/ui/actions';
import * as mopidyActions from '../services/mopidy/actions';
import * as spotifyActions from '../services/spotify/actions';
import * as discogsActions from '../services/discogs/actions';

const SecondaryLine = ({
sourceIcon = true,
Expand Down Expand Up @@ -99,6 +100,8 @@ const GridItem = ({
case 'artist':
if (spotify_available) {
dispatch(spotifyActions.getArtistImages(item));
} else {
dispatch(discogsActions.getArtistImages(item.uri, item));
}
break;
case 'playlist':
Expand Down
3 changes: 3 additions & 0 deletions src/js/components/ListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { updateScrollPosition } from './Link';
import * as uiActions from '../services/ui/actions';
import * as mopidyActions from '../services/mopidy/actions';
import * as spotifyActions from '../services/spotify/actions';
import * as discogsActions from '../services/discogs/actions';
import { isTouchDevice } from '../util/helpers';

const getValue = (item = {}, name = '') => {
Expand Down Expand Up @@ -112,6 +113,8 @@ const ListItem = ({
case 'artist':
if (spotify_available) {
dispatch(spotifyActions.getArtistImages(item));
} else {
dispatch(discogsActions.getArtistImages(item.uri, item));
}
break;
case 'album':
Expand Down
19 changes: 12 additions & 7 deletions src/js/util/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,18 @@ const makeLibrarySelector = (name, filtered = true) => createSelector(
},
);

const makeSearchResultsSelector = (providers, term, type) => createSelector(
[getSearchResults],
(searchResults) => providers.reduce(
(acc, curr) => [
...acc,
...searchResults[getSearchResultKey({ provider: curr, term, type })] || [],
], []),
const makeSearchResultsSelector = (providers, term, type) =>
createSelector(
[getSearchResults, getItems],
(searchResults, items) =>
providers.reduce((acc, provider) => {
const resultsForProvider = searchResults[getSearchResultKey({ provider, term, type })] || [];
const enrichedResults = resultsForProvider.map(result => ({
...result,
...(items[result.uri] || {}), // merge item details if loaded, so we get images in the search result window
}));
return [...acc, ...enrichedResults];
}, [])
);

const makeProcessProgressSelector = (keys) => createSelector(
Expand Down