Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const update = (name, newValue, evt) => {
newValue = roundMm(newValue, props.units);
// Sometimes, when sliding, the rapid succession of updates
// causes a weird timing issue to result in a value that is NaN.
// If that's the case, just ignore this update and keep the
// previous one instead
if (!isNaN(newValue)) {
setValue(newValue);
if (evt.type !== "mousemove") props.updateValue(props.name, newValue);
} else {
if (evt.type !== "mousemove") props.updateValue(props.name, value);
}
};
const update = (name, newValue, evt) => {
newValue = roundMm(newValue)
// Sometimes, when sliding, the rapid succession of updates
// causes a weird timing issue to result in a value that is NaN.
// If that's the case, just ignore this update and keep the
// previous one instead
if (!isNaN(newValue)) {
setValue(newValue)
if (evt.type !== 'mousemove') props.updateValue('margin', newValue)
} else {
props.updateValue('margin', value)
}
}
const updateCustom = (name, newValue, evt) => {
newValue = roundMm(newValue)
// Sometimes, when sliding, the rapid succession of updates
// causes a weird timing issue to result in a value that is NaN.
// If that's the case, just ignore this update and keep the
// previous one instead
if (!isNaN(newValue)) {
setSaValue(newValue)
setCustomValue(newValue)
if (evt.type !== 'mousemove') props.updateValue('sa', newValue)
} else {
props.updateValue('sa', customValue)
}
}