fix NaN when parsing empty string (#422)

This commit is contained in:
Sam Samskies 2023-03-10 06:09:23 -10:00 committed by GitHub
parent 3dccf21d2c
commit d70d77d71c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -149,9 +149,9 @@ const PreferencesPage = () => {
<div> <div>
<input <input
type="number" type="number"
value={perf.defaultZapAmount} defaultValue={perf.defaultZapAmount}
min={1} min={1}
onChange={e => dispatch(setPreferences({ ...perf, defaultZapAmount: parseInt(e.target.value) }))} onChange={e => dispatch(setPreferences({ ...perf, defaultZapAmount: parseInt(e.target.value || "0") }))}
/> />
</div> </div>
</div> </div>
@ -184,10 +184,10 @@ const PreferencesPage = () => {
<div> <div>
<input <input
type="number" type="number"
value={perf.fastZapDonate * 100} defaultValue={perf.fastZapDonate * 100}
min={0} min={0}
max={100} max={100}
onChange={e => dispatch(setPreferences({ ...perf, fastZapDonate: parseInt(e.target.value) / 100 }))} onChange={e => dispatch(setPreferences({ ...perf, fastZapDonate: parseInt(e.target.value || "0") / 100 }))}
/> />
</div> </div>
</div> </div>