In-memory search results cache
- Switching between type and provider now negates need for repeat queries - Mopidy caching varies, so for some providers this has a huge performance gain (eg YouTube) - Spotify will requery anyway, but the browser handles query caching
This commit is contained in:
@ -603,8 +603,7 @@ const upgradeSpotifyPlaylistUri = function (uri) {
|
||||
return upgradeSpotifyPlaylistUris([uri])[0];
|
||||
};
|
||||
|
||||
const getSearchResultKey = ({ provider, type, term }) =>
|
||||
[provider.replace(':', ''), type, term].join(':');
|
||||
const getSearchResultKey = ({ provider, type, term }) => [provider, type, term].join(':');
|
||||
|
||||
export {
|
||||
debounce,
|
||||
|
||||
@ -7,11 +7,13 @@ const useSearchQuery = () => {
|
||||
type = 'all',
|
||||
providers: rawProviders = 'all',
|
||||
} = useParams();
|
||||
const allProviders = useSelector((state) => state.mopidy?.uri_schemes || []);
|
||||
const allProviders = useSelector(
|
||||
({ mopidy: { uri_schemes } }) => uri_schemes || []
|
||||
).map((str) => str.replace(/:/g,''));
|
||||
const providers = rawProviders == 'all'
|
||||
? [...allProviders]
|
||||
: rawProviders.split(',').filter((str) => allProviders.indexOf(str) > -1);
|
||||
const providersString = providers.join(',').replace(/:/g,'');
|
||||
const providersString = providers.join(',');
|
||||
|
||||
return {
|
||||
term,
|
||||
|
||||
Reference in New Issue
Block a user