1
- import React , { memo , useState } from 'react' ;
1
+ import React , { memo , useState , useEffect } from 'react' ;
2
2
import PropTypes from 'prop-types' ;
3
3
import Button from '@material-ui/core/Button' ;
4
4
import Slider from '@material-ui/core/Slider' ;
@@ -120,6 +120,10 @@ export const DatasetMoleculeListSortFilter = memo(
120
120
isString
121
121
} ;
122
122
123
+ useEffect ( ( ) => {
124
+ setSliderValue ( [ normMinValue , normMaxValue ] ) ;
125
+ } , [ normMinValue , normMaxValue ] ) ;
126
+
123
127
const handleCheckboxChange = e => {
124
128
const isChecked = e . target . checked ;
125
129
@@ -142,7 +146,7 @@ export const DatasetMoleculeListSortFilter = memo(
142
146
} ;
143
147
144
148
const handleCommitChangeSlider = ( event , newValue ) => {
145
- setting . minValue = isBoolean ? 1 : ( isFloat ? newValue [ 0 ] / MULT : newValue [ 0 ] ) ;
149
+ setting . minValue = isFloat ? newValue [ 0 ] / MULT : newValue [ 0 ] ;
146
150
setting . maxValue = isFloat ? newValue [ 1 ] / MULT : newValue [ 1 ] ;
147
151
if ( newValue === 1 ) {
148
152
setting . isChecked = false ;
@@ -259,7 +263,7 @@ export const DatasetMoleculeListSortFilter = memo(
259
263
{ isBoolean && (
260
264
< >
261
265
< Grid item className = { classNames ( classes . min , classes . centered ) } style = { { width : widthMin } } >
262
- { " False" }
266
+ { ' False' }
263
267
</ Grid >
264
268
< Grid item className = { classNames ( classes . centered , classes . slider ) } style = { { width : widthSlider } } >
265
269
< Slider
@@ -268,44 +272,42 @@ export const DatasetMoleculeListSortFilter = memo(
268
272
onChangeCommitted = { handleCommitChangeSlider }
269
273
valueLabelDisplay = "auto"
270
274
step = { null }
271
- marks = { [ { value : 1 , label : "" , } , { value : 50 , label : "Ignore" , } , { value : 100 , label : "" , } , ] }
272
- getAriaValueText = {
273
- value => {
274
- if ( value === 0 ) {
275
- return "" ;
276
- } else if ( value === 100 ) {
277
- return "" ;
278
- } else {
279
- return "Ignore" ;
280
- }
275
+ marks = { [
276
+ { value : 1 , label : '' } ,
277
+ { value : 50 , label : 'Ignore' } ,
278
+ { value : 100 , label : '' }
279
+ ] }
280
+ getAriaValueText = { value => {
281
+ if ( value === 0 ) {
282
+ return '' ;
283
+ } else if ( value === 100 ) {
284
+ return '' ;
285
+ } else {
286
+ return 'Ignore' ;
281
287
}
282
- }
283
- getAriaLabel = {
284
- index => {
285
- if ( index === 0 ) {
286
- return "False" ;
287
- } else if ( index === 1 ) {
288
- return "Ignore" ;
289
- } else {
290
- return "True" ;
291
- }
288
+ } }
289
+ getAriaLabel = { index => {
290
+ if ( index === 0 ) {
291
+ return 'False' ;
292
+ } else if ( index === 1 ) {
293
+ return 'Ignore' ;
294
+ } else {
295
+ return 'True' ;
292
296
}
293
- }
294
- valueLabelFormat = {
295
- value => {
296
- if ( value === 1 ) {
297
- return "False" ;
298
- } else if ( value === 50 ) {
299
- return "Ignore" ;
300
- } else {
301
- return "True" ;
302
- }
297
+ } }
298
+ valueLabelFormat = { value => {
299
+ if ( value === 1 ) {
300
+ return 'False' ;
301
+ } else if ( value === 50 ) {
302
+ return 'Ignore' ;
303
+ } else {
304
+ return 'True' ;
303
305
}
304
- }
306
+ } }
305
307
/>
306
308
</ Grid >
307
309
< Grid item className = { classNames ( classes . min , classes . centered ) } style = { { width : widthMin } } >
308
- { " True" }
310
+ { ' True' }
309
311
</ Grid >
310
312
</ >
311
313
) }
0 commit comments