From 889f92268e0086f1312b5f54e55299159900b5d4 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 12 Apr 2019 19:05:23 -0700 Subject: [PATCH] Fixed: Series footer shows statistics based on filtered series list --- .../Index/SeriesIndexFooterConnector.js | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/frontend/src/Series/Index/SeriesIndexFooterConnector.js b/frontend/src/Series/Index/SeriesIndexFooterConnector.js index 18b48210a..3bcbbbad4 100644 --- a/frontend/src/Series/Index/SeriesIndexFooterConnector.js +++ b/frontend/src/Series/Index/SeriesIndexFooterConnector.js @@ -1,10 +1,40 @@ import { connect } from 'react-redux'; import { createSelector } from 'reselect'; +import createDeepEqualSelector from 'Store/Selectors/createDeepEqualSelector'; +import createClientSideCollectionSelector from 'Store/Selectors/createClientSideCollectionSelector'; import SeriesIndexFooter from './SeriesIndexFooter'; +function createUnoptimizedSelector() { + return createSelector( + createClientSideCollectionSelector('series', 'seriesIndex'), + (series) => { + return series.items.map((s) => { + const { + monitored, + status, + statistics + } = s; + + return { + monitored, + status, + statistics + }; + }); + } + ); +} + +function createSeriesSelector() { + return createDeepEqualSelector( + createUnoptimizedSelector(), + (series) => series + ); +} + function createMapStateToProps() { return createSelector( - (state) => state.series.items, + createSeriesSelector(), (series) => { return { series