WIP: Unified Housekeeping rebuild / Gecombineerde Housekeeping-herbouw #53

Closed
Simo wants to merge 68 commits from codex/housekeeping-rebuild-stepwise into main
pull from: codex/housekeeping-rebuild-stepwise
2 changed files with 105 additions and 4 deletions
Showing only changes of commit 5edaa0254c - Show all commits

No files matched your search

@@ -41,6 +41,7 @@ interface ContentCommandFormProps extends ContentCommandSubmission {
}
const OMIT_FIELD = Symbol("omit optional Content command field");
const UNCHECKED_CHECKBOX_VALUE = "false";
function optionalEmptyValue(field: ContentCommandField): unknown {
return field.emptyValue === null || field.emptyValue === ""
? field.emptyValue
@@ -115,7 +116,11 @@ function readSubmittedValues(
for (const field of fields) {
if (field.type === "file") continue;
const value = formData.get(field.name);
if (typeof value === "string") values[field.name] = value;
if (typeof value === "string") {
values[field.name] = value;
} else if (field.type === "checkbox" && !field.allowUnchanged) {
values[field.name] = UNCHECKED_CHECKBOX_VALUE;
}
}
if (requiresReason) {
const reason = formData.get("reason");
@@ -247,8 +252,9 @@ export function ContentCommandForm({
name={field.name}
type="checkbox"
defaultChecked={
retainedValue === "on" ||
(retainedValue === undefined && field.defaultValue === true)
retainedValue === undefined
? field.defaultValue === true
: retainedValue === "on"
}
{...fieldErrorProps}
/>{" "}
File diff suppressed because it is too large. Load diff