diff --git a/components/calendar.js b/components/calendar.js index 4ffce88eed7b09eaa5aa5620197f1b1606cdeda8..41345400e8e1f58d8c470421257e1fe70ce3e220 100644 --- a/components/calendar.js +++ b/components/calendar.js @@ -5,7 +5,7 @@ import { getOrCreateCycleDay, getBleedingDaysSortedByDate } from '../db' import cycleModule from '../lib/cycle' import {shadesOfRed} from '../styles/index' import styles from '../styles/index' - +import nothingChanged from '../helpers/db-unchanged' export default class CalendarView extends Component { constructor(props) { @@ -21,7 +21,8 @@ export default class CalendarView extends Component { this.bleedingDays.addListener(this.setStateWithCalFormattedDays) } - setStateWithCalFormattedDays = () => { + setStateWithCalFormattedDays = (_, changes) => { + if (nothingChanged(changes)) return const predictedMenses = cycleModule().getPredictedMenses() this.setState({ bleedingDaysInCalFormat: toCalFormat(this.bleedingDays), diff --git a/components/chart/chart.js b/components/chart/chart.js index 11f514269c5148868c8f6fd61a51bca32f9f6d61..14d03ce7c05a0bc39a8eb246be3d6c88f4e91109 100644 --- a/components/chart/chart.js +++ b/components/chart/chart.js @@ -19,6 +19,7 @@ import MucusIcon from '../../assets/mucus' import NoteIcon from '../../assets/note' import PainIcon from '../../assets/pain' import SexIcon from '../../assets/sex' +import nothingChanged from '../../helpers/db-unchanged' export default class CycleChart extends Component { constructor(props) { @@ -48,7 +49,8 @@ export default class CycleChart extends Component { if (this.state.chartHeight) return const height = nativeEvent.layout.height this.setState({ chartHeight: height }) - this.reCalculateChartInfo = () => { + this.reCalculateChartInfo = (_, changes) => { + if (nothingChanged(changes)) return // how many symptoms need to be displayed on the chart's upper symptom row? this.symptomRowSymptoms = [ 'bleeding',