Skip to content

Commit eeb0a8b

Browse files
dmealingclaude
andcommitted
docs(changelog): record the #223 blank-optional tristate fix
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DhpswkF1NvwxhFWMmdAT15
1 parent af6bd30 commit eeb0a8b

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,29 @@ now carries an enum, whose CHECK travels the same code path every other `extraCo
197197
source uses, and the devDependency moves in lockstep so the suite type-checks generated
198198
output **at** the declared floor rather than above it.
199199

200+
### Fixed — a blank optional form field submitted `""` instead of clearing ([#223](https://github.com/metaobjectsdev/metaobjects/issues/223))
201+
202+
A generated form passed raw values straight to `onSubmit`, so a blank optional control
203+
submitted `""`. An HTML control cannot distinguish "empty" from "not provided" — a blank
204+
text/date/number input, an unselected `<option value="">` and an empty textarea all yield
205+
the empty string — so on a nullable date/timestamp column that is not a legal value, and
206+
everywhere else it makes a `!= null` check read a blank field as SET.
207+
208+
The obvious fix is wrong, which is why this waited: deleting `""`-valued keys (what a
209+
downstream project did) breaks the EDIT path, because under FR-035's present-key tristate
210+
an ABSENT key means "leave untouched" — so clearing a previously-set field silently fails
211+
to clear it. The resolution is create-vs-edit aware, keyed on `defaultValues` exactly as
212+
the resolver already is (#227):
213+
214+
- **CREATE** (no `defaultValues`) — the key is OMITTED, so the column's `DEFAULT`/NULL applies.
215+
- **EDIT** (`defaultValues` present) — the key is sent as explicit `null`, which CLEARS it.
216+
217+
Scope is decided at codegen time from the metadata. A `@required` field is excluded —
218+
blank there is a validation error the schema already owns, and rewriting it would turn a
219+
caught error into a silent null. A checkbox and a `view.image` are excluded because
220+
neither can produce `""`. An entity with no blankable optional field emits no normalizer,
221+
so its output is byte-identical.
222+
200223
### Fixed — the AI-facing docs taught vocabulary this release removed ([#343](https://github.com/metaobjectsdev/metaobjects/issues/343))
201224

202225
`docs/llms/{llms.txt,llms-full.txt}` — the entry point `metaobjects.dev` serves to

0 commit comments

Comments
 (0)