Uh oh!
There was an error while loading. Please reload this page.
feat(form): parent-scoped conditional rules in inline grids (#1581) - #1607
Merged
Conversation
Wire the live header record into master-detail line grids as `parent` so a column's readonlyWhen/requiredWhen CEL rule can react to the header — the "paid invoice → lock lines" case (readonlyWhen: "parent.status == 'paid'"). The line grids + document totals move into a dedicated <MasterDetailLines> child that owns the scraped header record, so a header edit re-renders only the lines and never resets the header ObjectForm's react-hook-form state mid-edit. The scrape is deduped by value to avoid needless churn. Adds unit coverage (GridField contextRecord), integration coverage (MasterDetailForm scrape→lock + no-reset), and a live e2e spec. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
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 freeto 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.
Closes#1581 — B2 follow-up: parent-scoped conditional rules in inline grids ("paid invoice → lock lines").
What
Wire the live header record into master-detail line grids as
parent, so a column'sreadonlyWhen/requiredWhenCEL rule can react to the header — e.g.readonlyWhen: "parent.status == 'paid'"locks quantity / unit price / product when the invoice is paid.The CEL engine
parentscope,GridField.contextRecord, and column-rule derivation already existed; this wires the missing link inMasterDetailForm.How (the #1581 reset fix)
The line grids + document totals move into a dedicated
<MasterDetailLines>child that owns the scraped header record. A header edit therefore re-renders only the lines and never resets the headerObjectForm's react-hook-form state mid-edit. The scrape is deduped by value to avoid needless churn. Header<select>values are captured via Radix's hidden native select (whose change bubbles to the form host).Tests
GridField.test.tsx— parent-FALSE editable, parent-TRUE locks, per-rowparent+recordmix.MasterDetailForm.test.tsx— scrape→lock/unlock as status toggles, and header value survives the locking re-render (no reset).e2e/live/grid-parent-rules.spec.ts— new live e2e (pairs with the showcase backend rules).Verified in a real browser (real Radix
<select>): Paid → Qty/Unit Price lock, Product stays editable, values preserved; Draft → unlock.Backend counterpart (showcase
invoice_linerules) is a separate PR in the framework repo.🤖 Generated with Claude Code