fix: treat empty router settings inputs as null instead of preserving old values

When a user clears a numeric field in the RouterSettingsAccordion, the empty
input should result in null, not fall through to the previous value from state.
This commit is contained in:
Yuneng Jiang 2026-04-08 17:53:53 -07:00
parent 7654234f20
commit f93db822fd
No known key found for this signature in database

View file

@ -241,9 +241,13 @@ const RouterSettingsAccordion = forwardRef<RouterSettingsAccordionRef, RouterSet
key !== "fallbacks"
) {
const inputEl = document.querySelector(`input[name="${key}"]`) as HTMLInputElement | null;
if (inputEl && inputEl.value !== undefined && inputEl.value !== "") {
const parsed = parseInputValue(key, inputEl.value, value);
return [key, parsed];
if (inputEl) {
if (inputEl.value !== undefined && inputEl.value !== "") {
const parsed = parseInputValue(key, inputEl.value, value);
return [key, parsed];
}
// Input exists but is empty — user cleared it, set to null
return [key, null];
}
return [key, value];
} else if (key === "routing_strategy") {