Fix for empty boolean fields (#12100)

This commit is contained in:
Oliver 2026-06-06 09:34:22 +10:00 committed by GitHub
parent 6419c4ac5d
commit b9c063fe31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 3 deletions

View File

@ -55,7 +55,7 @@ export function getDetailUrl(
}
}
console.error(`No detail URL found for model ${model} <${pk}>`);
console.warn(`No detail URL found for model ${model} <${pk}>`);
return '';
}

View File

@ -25,9 +25,9 @@ export function BooleanField({
const { value } = field;
// Set default value if value is undefined
// Set default value if value is undefined or otherwise empty
useEffect(() => {
if (value === undefined) {
if (value === undefined || value === null || value === '') {
onChange(definition.default ?? false);
}
}, [value, definition]);

View File

@ -197,6 +197,7 @@ export function useParameterFields({
// This is a "checkbox" field
setChoices([]);
setFieldType('boolean');
setData('false');
} else if (record?.choices) {
const _choices: string[] = record.choices.split(',');