1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2025-06-13 21:48:39 -04:00

reports: Move flattening tabulations into reducer

This removes some circular control dependencies
This commit is contained in:
2017-06-17 14:24:02 -04:00
parent 9844785b8d
commit 6d4fdafc02
4 changed files with 68 additions and 56 deletions

View File

@ -156,10 +156,6 @@ class ReportsTab extends React.Component {
nextProps.onTabulateReport(nextProps.reports.map[nextProps.reports.list[0]]);
this.setState({initialized: true});
}
} else if (selected != -1 &&
nextProps.reports.tabulations.hasOwnProperty(selected) &&
nextProps.reports.selectedTabulation == null) {
nextProps.onSelectSeries(nextProps.reports.tabulations[selected]);
}
}
handleSelectSeries(series) {
@ -167,8 +163,7 @@ class ReportsTab extends React.Component {
return;
var seriesTraversal = this.props.reports.seriesTraversal.slice();
seriesTraversal.push(series);
var selectedTabulation = this.props.reports.tabulations[this.props.reports.selected];
this.props.onSelectSeries(selectedTabulation, seriesTraversal);
this.props.onSelectSeries(seriesTraversal);
}
handleSelectReport(report) {
this.props.onSelectReport(report);
@ -214,10 +209,9 @@ class ReportsTab extends React.Component {
var self = this;
var navOnClick = function() {
var onSelectSeries = self.props.onSelectSeries;
var tabulation = self.props.reports.tabulations[self.props.reports.selected];
var mySeriesTraversal = seriesTraversal.slice();
return function() {
onSelectSeries(tabulation, mySeriesTraversal);
onSelectSeries(mySeriesTraversal);
};
}();
titleTracks.push((