Debugging search performance issue; Genius intermittent rlyrics result rendered (seems like a different HTML body response)
This commit is contained in:
@ -742,6 +742,9 @@ const CoreMiddleware = (function () {
|
||||
|
||||
case 'ITEMS_LOADED':
|
||||
const mergedItems = [];
|
||||
|
||||
console.time('TIMER')
|
||||
// THE FOLLOWING LINES ARE THE CULPRIT
|
||||
action.items.forEach((item) => {
|
||||
mergedItems.push({
|
||||
...core.items[item.uri] || {},
|
||||
@ -749,6 +752,8 @@ const CoreMiddleware = (function () {
|
||||
});
|
||||
store.dispatch(uiActions.stopLoading(item.uri));
|
||||
});
|
||||
// ABOVE
|
||||
|
||||
store.dispatch(coreActions.updateColdStore(mergedItems));
|
||||
next({
|
||||
...action,
|
||||
|
||||
@ -80,6 +80,7 @@ export default function reducer(core = {}, action) {
|
||||
(obj, item) => (obj[item.uri] = item, obj),
|
||||
{},
|
||||
);
|
||||
console.timeEnd('TIMER');
|
||||
return {
|
||||
...core,
|
||||
items: {
|
||||
|
||||
@ -187,6 +187,8 @@ export function getTrackLyrics(uri, path) {
|
||||
lyrics_html = lyrics_html.replace(/(\[)/g, '<span class="mid_grey-text">[');
|
||||
lyrics_html = lyrics_html.replace(/(\])/g, ']</span>');
|
||||
|
||||
console.debug(lyrics_html);
|
||||
|
||||
dispatch(coreActions.itemLoaded({
|
||||
uri,
|
||||
lyrics: lyrics_html,
|
||||
|
||||
@ -1092,9 +1092,6 @@ const MopidyMiddleware = (function () {
|
||||
}
|
||||
}
|
||||
|
||||
let albums_uris = arrayOf('uri', albums);
|
||||
albums_uris = removeDuplicates(albums_uris);
|
||||
|
||||
store.dispatch(coreActions.itemsLoaded(albums));
|
||||
|
||||
// and plug in their URIs
|
||||
|
||||
@ -585,10 +585,6 @@ export function getSearchResults(type, term, limit = 50, offset = 0) {
|
||||
}
|
||||
|
||||
if (response.artists !== undefined) {
|
||||
dispatch({
|
||||
type: 'ARTISTS_LOADED',
|
||||
artists: response.artists.items,
|
||||
});
|
||||
dispatch({
|
||||
type: 'SPOTIFY_SEARCH_RESULTS_LOADED',
|
||||
context: 'artists',
|
||||
@ -596,13 +592,13 @@ export function getSearchResults(type, term, limit = 50, offset = 0) {
|
||||
results: arrayOf('uri', response.artists.items),
|
||||
more: response.artists.next,
|
||||
});
|
||||
// TODO: Loading items into index causes massive performance issue
|
||||
// Not the formatter, not coldstorage (async) and not building new index
|
||||
dispatch(coreActions.itemsLoaded(formatArtists(response.artists.items)));
|
||||
}
|
||||
|
||||
if (response.albums !== undefined) {
|
||||
dispatch({
|
||||
type: 'ALBUMS_LOADED',
|
||||
albums: response.albums.items,
|
||||
});
|
||||
//dispatch(coreActions.itemsLoaded(formatAlbums(response.albums.items)));
|
||||
dispatch({
|
||||
type: 'SPOTIFY_SEARCH_RESULTS_LOADED',
|
||||
context: 'albums',
|
||||
@ -618,10 +614,7 @@ export function getSearchResults(type, term, limit = 50, offset = 0) {
|
||||
can_edit: (getState().spotify.me && item.owner.id === getState().spotify.me.id),
|
||||
tracks_total: item.tracks.total,
|
||||
}));
|
||||
dispatch({
|
||||
type: 'PLAYLISTS_LOADED',
|
||||
playlists,
|
||||
});
|
||||
//dispatch(coreActions.itemsLoaded(playlists));
|
||||
|
||||
dispatch({
|
||||
type: 'SPOTIFY_SEARCH_RESULTS_LOADED',
|
||||
|
||||
Reference in New Issue
Block a user