@@ -71,12 +71,6 @@ export default class YmdTimestampHeader extends React.Component {
7171 }
7272 }
7373
74- componentDidUpdate ( ) {
75- if ( ( this . state . leftSnaps || this . state . rightSnaps ) && ! this . state . showError ) {
76- this . _selectValues ( ) ;
77- }
78- }
79-
8074 componentWillUnmount ( ) {
8175 this . _abortController . abort ( ) ;
8276 }
@@ -294,17 +288,6 @@ export default class YmdTimestampHeader extends React.Component {
294288 this . props . getTimestampsCallback ( this . state . timestampA , this . state . timestampB ) ;
295289 } ;
296290
297- // Note that this runs 3 times until it picks the right values. TODO optimise.
298- _selectValues = ( ) => {
299- const { leftSnaps, rightSnaps } = this . state ;
300-
301- if ( this . state . sparkline && ! this . state . leftMonthOptions && ! this . state . rightMonthOptions ) {
302- if ( this . state . leftMonth !== '' || this . state . rightMonth !== '' ) {
303- this . _showMonths ( this . state . leftYear , this . state . rightYear ) ;
304- }
305- }
306- } ;
307-
308291 _getHeaderInfo = ( firstTimestamp , lastTimestamp , count ) => {
309292 const first = getShortUTCDateFormat ( firstTimestamp ) ;
310293 const last = getShortUTCDateFormat ( lastTimestamp ) ;
@@ -347,6 +330,8 @@ export default class YmdTimestampHeader extends React.Component {
347330 sparkline : snapshots ,
348331 yearOptions : this . _showOptions ( yearSum ) ,
349332 headerInfo : this . _getHeaderInfo ( data . first_ts , data . last_ts , allSum )
333+ } , ( ) => {
334+ this . _showMonths ( this . state . leftYear , this . state . rightYear ) ;
350335 } ) ;
351336 } ;
352337
0 commit comments