mirror of
https://github.com/immich-app/immich.git
synced 2025-11-20 14:52:40 +09:00
fix: optional number inputs (#20218)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user