Insert state into strategic components rather than entire app

This commit is contained in:
John Furrow
2015-11-08 21:34:05 -08:00
parent cf11f386d8
commit 535652d074
12 changed files with 227 additions and 126 deletions
@@ -9,7 +9,9 @@ const torrentListSortBy = state => state.ui.torrentList.sortBy;
const torrentListFilterBy = state => state.ui.torrentList.filterBy;
const torrentList = state => state.torrents;
const selectedTorrents = state => state.torrents.selectedTorrents;
const torrentList = state => state.torrents.torrents;
const filteredTorrents = createSelector(
torrentListFilterBy,
@@ -27,12 +29,23 @@ const searchedTorrents = createSelector(
}
);
const torrentSelector = createSelector(
torrentListSortBy,
const sortedTorrents = createSelector(
searchedTorrents,
(torrentListSortBy, searchedTorrents) => {
torrentListSortBy,
(searchedTorrents, torrentListSortBy) => {
return sortTorrents(searchedTorrents, torrentListSortBy);
}
);
const torrentSelector = createSelector(
selectedTorrents,
sortedTorrents,
(selectedTorrents, sortedTorrents) => {
return {
selectedTorrents,
torrents: sortedTorrents
};
}
);
export default torrentSelector;