localized_text edit can leave a stale other-language sub-value #41
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Follow-up from the instance-locale milestone (single-language content authoring,
docs/superpowers/specs/2026-06-05-instance-locale-and-content-authoring-design.md).The
LocalizedTextfield input (web/src/objects/field-input.tsx,case "localized_text")now registers a single input at
${key}.${default_language}. On the object edit path,react-hook-form seeds
defaultValues.fieldsfromobject.fieldsverbatim(
object-edit-form.tsx). If a storedlocalized_textvalue was authored under a differentlanguage than the current instance default — e.g. stored
{ title_ml: { en: "Vase" } }on aninstance whose
DEFAULT_LANGUAGEis nowsv— the form registerstitle_ml.svinto theexisting subtree. Saving then yields
{ en: "Vase", sv: "Vas" }(if the user types) or leavesthe stale
{ en }untouched (if they don't).set_fieldsis full-replace and validates theshape, so this is not data loss — but it silently accumulates a hidden, non-default-language
key that display (
labelText/pick_labelfall-through) may surface unexpectedly.Why it's an edge
A fresh Sweden-first deployment (default
sv, content authored insv) never hits this — itonly matters if an instance had
localized_textdata in another language before the defaultwas set/changed. Non-blocking; flagged in the milestone's final review.
Ask
localized_textvalue, normalize to keep only the default-languagekey (strip other-language sub-values), OR document that pre-existing multilingual field
values are preserved as-is and only the default-language slot is edited.
localized_texthas a non-default-language key →the saved value contains only the default-language key (or the documented behavior).
Notes
LabelEditor) already replaces the whole array with a singledefault-language entry, so this only concerns the
localized_textfield-value map.