mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
fix: optional number inputs (#20218)
This commit is contained in:
parent
13281f8531
commit
edefed56ae
2 changed files with 6 additions and 1 deletions
|
|
@ -46,6 +46,6 @@ describe('SettingInputField component', () => {
|
|||
expect(numberInput.value).toEqual('');
|
||||
|
||||
await user.click(document.body);
|
||||
expect(numberInput.value).toEqual('0');
|
||||
expect(numberInput.value).toEqual('');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -49,6 +49,11 @@
|
|||
value = e.currentTarget.value;
|
||||
|
||||
if (inputType === SettingInputFieldType.NUMBER) {
|
||||
if (value === '' && !required) {
|
||||
value = null;
|
||||
return;
|
||||
}
|
||||
|
||||
let newValue = Number(value) || 0;
|
||||
if (newValue < min) {
|
||||
newValue = min;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue