File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -6,21 +6,21 @@ import {
66 Tooltip ,
77} from "@mui/material" ;
88
9- // NOTE THIS DOESN'T WORK BECAUSE IT DOES NOT LIKE BOOLEANS!!!
10- // TODO LOTS OF CASTING
119export function PumpProbeSelection ( {
1210 pumpProbe,
1311 setPumpProbe,
1412} : {
1513 pumpProbe : boolean ;
1614 setPumpProbe : React . Dispatch < React . SetStateAction < boolean > > ;
1715} ) {
18- const handleChange = ( choice : string | boolean ) => {
19- const ppVal = String ( pumpProbe ) ;
20- console . log ( ppVal ) ;
21- console . log ( choice ) ;
22- console . log ( Boolean ( choice ) ) ;
23- setPumpProbe ( Boolean ( choice ) ) ;
16+ const handleChange = ( choice : string ) => {
17+ let newValue : boolean ;
18+ if ( choice . toLowerCase ( ) === "true" ) {
19+ newValue = true ;
20+ } else {
21+ newValue = false ;
22+ }
23+ setPumpProbe ( newValue ) ;
2424 } ;
2525 return (
2626 < Tooltip title = "Is this a pump probe experiment?" placement = "right" >
@@ -29,7 +29,7 @@ export function PumpProbeSelection({
2929 < Select
3030 labelId = "pp-ex"
3131 id = "pp"
32- value = { pumpProbe }
32+ value = { String ( pumpProbe ) }
3333 label = "Pump Probe"
3434 onChange = { ( e ) => handleChange ( e . target . value ) }
3535 >
You can’t perform that action at this time.
0 commit comments