mirror of
https://github.com/immich-app/immich.git
synced 2025-07-31 15:08:44 -04:00
fix: optional number inputs (#20218)
This commit is contained in:
parent
13281f8531
commit
edefed56ae
@ -46,6 +46,6 @@ describe('SettingInputField component', () => {
|
|||||||
expect(numberInput.value).toEqual('');
|
expect(numberInput.value).toEqual('');
|
||||||
|
|
||||||
await user.click(document.body);
|
await user.click(document.body);
|
||||||
expect(numberInput.value).toEqual('0');
|
expect(numberInput.value).toEqual('');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -49,6 +49,11 @@
|
|||||||
value = e.currentTarget.value;
|
value = e.currentTarget.value;
|
||||||
|
|
||||||
if (inputType === SettingInputFieldType.NUMBER) {
|
if (inputType === SettingInputFieldType.NUMBER) {
|
||||||
|
if (value === '' && !required) {
|
||||||
|
value = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let newValue = Number(value) || 0;
|
let newValue = Number(value) || 0;
|
||||||
if (newValue < min) {
|
if (newValue < min) {
|
||||||
newValue = min;
|
newValue = min;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user