@@ -135,6 +135,7 @@ export default class YmdTimestampHeader extends React.Component {
135135 < select className = "form-control input-sm mr-sm-1 timestamp-select"
136136 ref = { this . timestampSelectLeft }
137137 onChange = { this . _handleLeftTimestampChange }
138+ value = { this . state . timestampA }
138139 defaultValue = "" >
139140 < option value = "" disabled > Available captures</ option >
140141 { this . state . leftSnaps . map ( ( item , index ) => (
@@ -151,6 +152,7 @@ export default class YmdTimestampHeader extends React.Component {
151152 < select className = "form-control input-sm mr-sm-1 timestamp-select"
152153 ref = { this . timestampSelectRight }
153154 onChange = { this . _handleRightTimestampChange }
155+ value = { this . state . timestampB }
154156 defaultValue = "" >
155157 < option value = "" disabled > Available captures</ option >
156158 { this . state . rightSnaps . map ( ( item , index ) => (
@@ -294,13 +296,7 @@ export default class YmdTimestampHeader extends React.Component {
294296
295297 // Note that this runs 3 times until it picks the right values. TODO optimise.
296298 _selectValues = ( ) => {
297- const { timestampA, timestampB, leftSnaps, rightSnaps } = this . state ;
298- if ( ! isEmpty ( leftSnaps ) && timestampA ) {
299- this . timestampSelectLeft . current . value = timestampA ;
300- }
301- if ( ! isEmpty ( rightSnaps ) && timestampB ) {
302- this . timestampSelectRight . current . value = timestampB ;
303- }
299+ const { leftSnaps, rightSnaps } = this . state ;
304300
305301 if ( this . state . sparkline && ! this . state . leftMonthOptions && ! this . state . rightMonthOptions ) {
306302 if ( this . state . leftMonth !== '' || this . state . rightMonth !== '' ) {
@@ -369,14 +365,16 @@ export default class YmdTimestampHeader extends React.Component {
369365 if ( e . target . className . includes ( 'left' ) ) {
370366 this . setState ( {
371367 leftMonth : e . target . value ,
372- leftSnaps : null
368+ leftSnaps : null ,
369+ timestampA : null
373370 } , ( ) => {
374371 this . _fetchCDXData ( ) ;
375372 } ) ;
376373 } else {
377374 this . setState ( {
378375 rightMonth : e . target . value ,
379- rightSnaps : null
376+ rightSnaps : null ,
377+ timestampB : null
380378 } , ( ) => {
381379 this . _fetchCDXData ( ) ;
382380 } ) ;
0 commit comments