feat(templates): a field's defaultValue seeds a new line in the item dialog - #6691
Open
delchev wants to merge 1 commit into
Open
feat(templates): a field's defaultValue seeds a new line in the item dialog#6691delchev wants to merge 1 commit into
delchev wants to merge 1 commit into
Conversation
…dialog `defaultValue:` already reached the model - it becomes the column's DB DEFAULT and suppresses a required field's presence check - but no UI ever seeded from it. A document's item dialog built a new line from blanks (checkbox false, number null, else ''), so every "default" was invisible until the row was posted. The visible cost: Fill Month. The guide promises it "creates an 8-hour line for every working day", and the dialog's skip-existing-days and Mon-Fri rules do match - but Hours opened empty and Billable opened off, so the one-click promise was really type-8-toggle-billable-click. The registry now emits the authored default as `def` on the column, in the shape the draft holds: a checkbox gets a real boolean, a numeric column a real number, and everything else a string - including a DROPDOWN's FK, which the draft keeps stringified so it matches an option's data-value. openRowDialog seeds a NEW line from it. An EXISTING row is untouched: re-defaulting a value the user deliberately cleared would silently undo it. Deliberately item-dialog only. The main create form is left alone: every entity with an `init:` status carries a dataDefaultValue too, so seeding forms as well would visibly change create screens across the whole fleet - a separate change with its own blast radius, not something to smuggle in behind a dialog fix. Verified by rendering both templates through a real Velocity engine: a NUMBER default emits `def: 8`, a CHECKBOX `def: true`, a numeric DROPDOWN FK `def: '2'`, and a column without a default emits no key at all; the rendered registry parses as JS. The seeding line was then simulated over new/edit/cleared rows - a new line takes the defaults, an edited row keeps its stored values, and a cleared value is not re-defaulted. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
defaultValue:on a field already reached the model — it becomes the column's DB DEFAULT and suppresses a required field's presence check — but no UI ever seeded from it. A document's item dialog built a new line out of blanks (falsefor a checkbox,nullfor a number,''otherwise), so every authored default was invisible until the row was posted.The visible cost is Fill Month. The guide promises it "creates an 8-hour line for every working day (Mon–Fri)", and the dialog's skip-existing-days and Mon–Fri rules do match — but
Hoursopened empty andBillableopened off, so the one-click promise was really type-8-toggle-billable-click.Change
The detail registry emits the authored default as
defon the column, in the shape the draft holds:NUMBERdef: 8(real number)CHECKBOXdef: true(real boolean)DROPDOWN(numeric FK)def: '2'(string — the draft keeps FKs stringified so they match an option'sdata-value)openRowDialogseeds a new line from it. An existing row is untouched — re-defaulting a value the user deliberately cleared would silently undo it.Scope
Deliberately item-dialog only. The main create form is left alone: every entity with an
init:status carries adataDefaultValuetoo, so seeding forms as well would visibly change create screens across the whole fleet — a separate change with its own blast radius, not something to smuggle in behind a dialog fix.The DSL key itself needed no work — it already binds and already emits. It was, however, undocumented beyond a passing mention, so
intent-assistant-guide.mdnow describes all three things it does.Verification
Both templates rendered through a real Velocity engine with a NUMBER / CHECKBOX / numeric-DROPDOWN / no-default / text-default property set, confirming the table above and that the rendered registry parses as JS (
node --check).The seeding line was then simulated over new / edit / cleared rows:
{Hours: 8, Billable: true, Status: '2', Note: ''}🤖 Generated with Claude Code