From cf48c79b4d34088f53e2a9b0c37dd48db5fc5c9d Mon Sep 17 00:00:00 2001 From: Rick Watson Date: Fri, 9 Aug 2019 21:26:31 +0100 Subject: [PATCH] fix bug introduced in value change code --- interface/src/components/RestComponent.js | 9 ++++++++- interface/src/project/DemoController.js | 8 ++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/interface/src/components/RestComponent.js b/interface/src/components/RestComponent.js index 5bcd8ec..813840a 100644 --- a/interface/src/components/RestComponent.js +++ b/interface/src/components/RestComponent.js @@ -89,7 +89,13 @@ export const restComponent = (endpointUrl, FormComponent) => { }); } - handleValueChange = name => (event, newValue) => { + handleValueChange = name => (event) => { + const { data } = this.state; + data[name] = event.target.value; + this.setState({ data }); + }; + + handleSliderChange = name => (event, newValue) => { const { data } = this.state; data[name] = newValue; this.setState({ data }); @@ -105,6 +111,7 @@ export const restComponent = (endpointUrl, FormComponent) => { return } /> @@ -53,7 +53,7 @@ const useStyles = makeStyles(theme => ({ })); function DemoControllerForm(props) { - const { demoSettings, onSubmit, onReset, handleValueChange } = props; + const { demoSettings, onSubmit, onReset, handleSliderChange } = props; const classes = useStyles(); return ( @@ -67,7 +67,7 @@ function DemoControllerForm(props) { valueLabelDisplay="on" min={0} max={255} - onChange={handleValueChange('blink_speed')} + onChange={handleSliderChange('blink_speed')} />