From 345b69b7d7cebbf571678029e04e8c1c8d8b0d1b Mon Sep 17 00:00:00 2001 From: Roland Date: Sun, 31 May 2026 12:53:04 -0600 Subject: [PATCH] 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. --- app/src/hooks/useForm.js | 5 ++--- modules/videos/lib.py | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/hooks/useForm.js b/app/src/hooks/useForm.js index eaf14fb8..ff76fa7b 100644 --- a/app/src/hooks/useForm.js +++ b/app/src/hooks/useForm.js @@ -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 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); diff --git a/modules/videos/lib.py b/modules/videos/lib.py index dbda2b26..e3682aca 100644 --- a/modules/videos/lib.py +++ b/modules/videos/lib.py @@ -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