🐛 Fixed draft only setting to hold value across renders
This commit is contained in:
parent
329e0f0ac8
commit
bca31494c6
2 changed files with 8 additions and 4 deletions
|
@ -5,7 +5,7 @@ import FormControlLabel from "@material-ui/core/FormControlLabel";
|
|||
import Checkbox from "@material-ui/core/Checkbox";
|
||||
|
||||
const FormFieldChecks = props => {
|
||||
const [value, setValue] = useState(props.dflt);
|
||||
const [value, setValue] = useState(props.dflt ? props.dflt : []);
|
||||
|
||||
const toggle = part => {
|
||||
let parts = value.slice(0);
|
||||
|
|
|
@ -4,8 +4,12 @@ import FormFieldList from "../../.form/FormFieldList";
|
|||
import OptionPreamble from "../OptionPreamble";
|
||||
|
||||
const DraftSettingOnly = props => {
|
||||
const [value, setValue] = useState(props.dflt);
|
||||
const [parts, setParts] = useState([]);
|
||||
const [value, setValue] = useState(
|
||||
props.value === null ? "dflt" : props.value === false ? "dflt" : "custom"
|
||||
);
|
||||
const [parts, setParts] = useState(
|
||||
value === "custom" ? props.value : props.customDflt
|
||||
);
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
|
||||
const update = (name, newValue, evt) => {
|
||||
|
@ -51,7 +55,7 @@ const DraftSettingOnly = props => {
|
|||
checks={props.parts}
|
||||
name="parts"
|
||||
value={value}
|
||||
dflt={props.customDflt}
|
||||
dflt={parts}
|
||||
onChange={updateCustom}
|
||||
label="po-list-only"
|
||||
updateValue={updateCustom}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue