chore: address Greptile P2 review comments on PR 449

- In get_effective_video_settings: on unparseable sleep_requests, delete
  the key instead of forcing 0.0. This lets the global config default
  (already present from _extract_global_inheritable) take effect, as
  suggested by Greptile.

- In handleInputEvent: add explicit `value !== ''` guard before the
  isNaN check. Prevents silent NaN in form state for empty number
  fields (isNaN('') === false in JS).

Both changes are strict improvements with no behavior change for
valid inputs.
This commit is contained in:
Roland 2026-05-31 12:53:04 -06:00
parent 9cc5c15e32
commit 345b69b7d7
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
2 changed files with 5 additions and 4 deletions

View file

@ -150,11 +150,10 @@ export function useForm({
let {type, value} = e.target;
let {path} = e.target.dataset;
path = path || e.target.name;
if (type === 'number' && !isNaN(value)) {
if (type === 'number' && value !== '' && !isNaN(value)) {
// Use parseFloat (not parseInt) so decimal values (sleep_requests=0.75, durations, etc.)
// coming from <input type="number" step="0.25"> are preserved as floats.
// This fixes the TypeError when those values later reach Python's > 0 comparison.
// Whole numbers (e.g. 42) remain proper numbers.
// The explicit empty-string check prevents isNaN('') === false from producing NaN in state.
value = parseFloat(value);
}
console.debug('handleInputEvent', 'path=', path, 'type=', type, 'value=', value);

View file

@ -789,7 +789,9 @@ def get_effective_video_settings(download_settings: dict = None) -> dict:
try:
effective['sleep_requests'] = float(effective['sleep_requests'])
except (TypeError, ValueError):
effective['sleep_requests'] = 0.0
# Remove corrupt value so the global config default (already populated
# earlier via _extract_global_inheritable) takes effect.
del effective['sleep_requests']
return effective