1
0
Fork 0

🐛 Fixed handling of language/margin draft settings across renders

This commit is contained in:
Joost De Cock 2019-07-04 15:50:33 +02:00 committed by Joost De Cock
parent bca31494c6
commit 371a27f3fd
2 changed files with 6 additions and 2 deletions

View file

@ -6,7 +6,9 @@ import { injectIntl } from "react-intl";
import { languages } from "@freesewing/i18n"; import { languages } from "@freesewing/i18n";
const DraftSettingLanguage = props => { const DraftSettingLanguage = props => {
const [value, setValue] = useState(props.intl.locale); const [value, setValue] = useState(
props.value === null ? props.intl.locale : props.value
);
const [expanded, setExpanded] = useState(false); const [expanded, setExpanded] = useState(false);
const update = (name, newValue, evt) => { const update = (name, newValue, evt) => {

View file

@ -5,7 +5,9 @@ import { formatMm, roundMm, sliderStep } from "@freesewing/utils";
import OptionPreamble from "../OptionPreamble"; import OptionPreamble from "../OptionPreamble";
const DraftSettingMargin = props => { const DraftSettingMargin = props => {
const [value, setValue] = useState(props.dflt); const [value, setValue] = useState(
props.value === null ? props.dflt : props.value
);
const [expanded, setExpanded] = useState(false); const [expanded, setExpanded] = useState(false);
const update = (name, newValue, evt) => { const update = (name, newValue, evt) => {