Lighten the comment load
Deploy / deploy (push) Successful in 1m1s

Drops porting-history narratives (dodrenett), superseded-behavior
explanations, and restatements of what the next line does. Constraint
notes (fail-closed policies, CAS semantics, cascade behavior, id
uniqueness) stay, just shorter. No code changes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Bendik Aagaard Lynghaug
2026-08-12 22:55:36 +02:00
co-authored by Claude Sonnet 5
parent 20b24f08c2
commit 6932816c42
8 changed files with 105 additions and 222 deletions
+6 -12
View File
@@ -479,14 +479,9 @@ fn AlternativeCard(
}
});
// File fields don't fit a live-typed RwSignal<String> - they get
// their own map of element refs, read (and uploaded) only at submit
// time, and are excluded from `field_map` below. `select` fields
// don't fit it either (a multi-select's value is a *set* of ids,
// not one string) - they get their own `Vec<String>`-signal map,
// plus a plain (non-reactive, content-derived) record of which
// select fields are `multiple`, read back at submit time to decide
// whether to emit a JSON array or a single string.
// Text fields live in field_map; file fields (element refs, read at
// submit) and select fields (a set of ids, plus which are multiple)
// each need their own shape.
let mut field_map: std::collections::HashMap<String, RwSignal<String>> =
std::collections::HashMap::new();
let mut file_refs: std::collections::HashMap<String, NodeRef<leptos::html::Input>> =
@@ -511,10 +506,9 @@ fn AlternativeCard(
}
}
// Prefixes field DOM ids with the alternative too, not just the
// question - two alternatives on the same page (e.g. both asking for
// "email") would otherwise mint the same id twice, which is invalid
// HTML and makes <label for=…> pick the wrong input.
// DOM ids are prefixed with question AND alternative - two
// alternatives on one page can both ask for "email", and duplicate
// ids would make <label for=...> pick the wrong input.
let field_prefix = format!(
"{question_id}-{}",
alternative.name.to_lowercase().replace(' ', "-")