Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// set `active` property on all playlists
playlists: mapValues(state.playlists, (playlist) => ({
...playlist,
loading: playlist._id === payload.playlistID ? false : playlist.loading,
active: playlist._id === payload.playlistID,
})),
activePlaylistID: payload.playlistID,
};
case SELECT_PLAYLIST: {
const { currentFilter } = state;
const shouldClearFilter = currentFilter && currentFilter.playlistID !== payload.playlistID;
return {
...state,
currentFilter: shouldClearFilter ? {} : currentFilter,
// set `selected` property on playlists
playlists: mapValues(state.playlists, (playlist) => ({
...playlist,
selected: playlist._id === payload.playlistID,
})),
selectedPlaylistID: payload.playlistID,
};
}
case SEARCH_START:
// We deselect playlists when doing a search, so the UI can switch to the
// search results view instead.
return {
...state,
playlists: deselectAll(state.playlists),
selectedPlaylistID: null,
};
case SEARCH_DELETE:
// Select the active playlist when search results are closed while they
function deselectAll(playlists) {
return mapValues(playlists, (playlist) => (
playlist.selected
? { ...playlist, selected: false }
: playlist
));
}
createEmptyCounts() {
return mapValues(itemsToCheck, () => 0)
}
}
const getOptionDefs = simpleMemoize(() => {
const unsolderedFeatures = omitBy(features, feature => feature.metadata.isSoldered)
const optionDefs = mapValues(unsolderedFeatures, feature => feature.metadata.optionDefs)
return optionDefs
})
(mutes) => mapValues(mutes, (mute) => mute.expirationTimer),
);