diff --git a/sites/shared/components/sets/measie-input.mjs b/sites/shared/components/sets/measie-input.mjs index 87bb0b5e523..dfc832c3a7d 100644 --- a/sites/shared/components/sets/measie-input.mjs +++ b/sites/shared/components/sets/measie-input.mjs @@ -101,7 +101,6 @@ export const MeasieInput = ({ stopLoading = () => null, }) => { const isDegree = isDegreeMeasurement(m) - const factor = isDegree ? 1 : mset.imperial ? 25.4 : 10 const units = mset.imperial ? 'imperial' : 'metric' const [val, setVal] = useState(() => { const measie = mset.measies?.[m] @@ -123,7 +122,7 @@ export const MeasieInput = ({ onUpdate(m, useVal) } }, - [isDegree, setValid, setVal, onUpdate, units] + [isDegree, setValid, setVal, onUpdate, units, m] ) const save = async () => { @@ -139,7 +138,7 @@ export const MeasieInput = ({ stopLoading() } - const fraction = (i, base) => update(Math.floor(('' + val).split(/[\s\.]/)[0]) + i / base) + const fraction = (i, base) => update(Math.floor(('' + val).split(/[\s.]/)[0]) + i / base) if (!m) return null diff --git a/sites/shared/components/workbench/menus/design-options/index.mjs b/sites/shared/components/workbench/menus/design-options/index.mjs index f084157a361..e1321e6dfe8 100644 --- a/sites/shared/components/workbench/menus/design-options/index.mjs +++ b/sites/shared/components/workbench/menus/design-options/index.mjs @@ -51,8 +51,6 @@ const DesignOption = ({ config, settings, control, ...rest }) => { ) } -const getDocsPath = (option) => - `designs/${design}/options${option ? '/' + option.toLowerCase() : ''}` /** * The design options menu * @param {String} options.design the name of the design @@ -80,6 +78,12 @@ export const DesignOptions = ({ [update] ) + // FIXME How do we find inherited docs? + const getDocsPath = useCallback( + (option) => `designs/${design}/options${option ? '/' + option.toLowerCase() : ''}`, + [design] + ) + return ( { + const { handleChange } = props const onUpdate = useCallback( (validVal) => { - if (validVal !== null && validVal !== false) props.handleChange(validVal) + if (validVal !== null && validVal !== false) handleChange(validVal) }, - [props.handleChange] + [handleChange] ) return ( @@ -422,11 +423,12 @@ export const PctInput = ({ current, changed, updateFunc, config, ...rest }) => { /** A {@see SliderInput} to handle degree values */ export const DegInput = (props) => { + const { updateFunc } = props const degUpdateFunc = useCallback( (path, newVal) => { - props.updateFunc(path, newVal === undefined ? undefined : Number(newVal)) + updateFunc(path, newVal === undefined ? undefined : Number(newVal)) }, - [props.updateFunc] + [updateFunc] ) return } diff --git a/sites/shared/utils.mjs b/sites/shared/utils.mjs index fa749e138e7..40d6a4540a4 100644 --- a/sites/shared/utils.mjs +++ b/sites/shared/utils.mjs @@ -204,8 +204,6 @@ export const measurementAsMm = (value, units = 'metric') => { if (isNaN(decimal)) return false return decimal * 24.5 } - - return false } export const optionsMenuStructure = (options) => {