Repository navigation
fix(console): a related tab's New keeps the parent it prefills when the child's relationship lookup declares dependsOn - #37283
Conversation
…37246, red) Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
…37246, red) Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
…endsOn fields from the parent (#37246) The New pre-linked the parent alone, so a child relationship lookup that declares dependsOn drew gated (the parent hidden), or its lookupAutofill filled the account and the dependent clear emptied the parent, and the child saved unlinked. The bridge now seeds each dependsOn field from the parent record (relatedCreateSeedOf, the pairs the derived Add picker scopes by), carried as repeated formLink pairs the record-form overlay reads. Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
…lated-new-dependson-prefill
…ooks/globals) Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D Final head for L1 (p1) · area a4-U · 2026-11-25T12:26Z Card #37246. Dev report: 7162330362.
Handed to the seat session for L1. |
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — REWORK · L1 · head
|
…geset declares the widening (#37246) Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D Final head for the delta read and the contract review (rework round 1, p1) · area a4-U · 2026-11-25T13:37Z Against REWORK 7162744164. Dev report: 7163964178. This is one commit on top of
Handed to the seat session for the delta L1 and the TIER_DEFAULT contract review. |
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — ACCEPT · L1 · head
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ Contract reviewServed-tier: ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — ACCEPT · L1 · head
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ Contract reviewServed-tier: ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Implemented-by: VERDICT: PASS |
|
repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D Landing · area a4-U · 2026-11-25T14:18Z · head
State change: ready for review, and auto-merge is armed. The queue lands it. On MERGED, #37246 closes through |
Fixes #37246
Clause-②: yes (widening) — one new export,
relatedCreateSeedOf, on the published@object-ui/plugin-detail/coresubpath; nothing is removed or renamed, and the package root exports the same names as beforeMetadata-protocol: none
维护者速读
What changes
A record page's related tab, New (the header's, or the one inside the Add picker), opened the child's create form with the parent link alone. When the child's relationship lookup declares
dependsOn(a billing milestone's orderdependsOnthe milestone's account), the form drew the lookup gated ("Select Account first", the parent hidden); with alookupAutofillthat fills the account from the order, the opening fill wrote the account and the form's dependent-lookup clear then emptied the order, and Create saved the child withcrm_sales_order: null, no error shown.Root cause: the New path seeded only the parent link (
formLink= oneFIELD:IDpair). The lookup's own + New already seeds itsdependsOnvalues (#35050) and the derived Add picker already scopes by them (#36729); the tab's New did neither.Fix (smallest change, one copy of the relation logic):
ui/packages/plugin-detail/src/relatedParentScope.ts(new, pure, exported on/coreonly, the subpath its one consumer imports):dependsOnFromParentis thedependsOninversionparentScopeOfused to carry inline, moved here unchanged;relatedCreateSeedOf(childFields, referenceField, parentRecord)reads the same pairs as values.RelatedList.tsx'sparentScopeOfnow callsdependsOnFromParent, so the picker scope and the New seed cannot drift.ui/packages/app-shell/src/views/RelatedRecordActionsBridge.tsx:onCreateadds the seed to the link;openChildFormwrites the parent pair first, then oneformLinkpair per seeded value (refresh-safe, like the link). A custom page's lists (parentFromList) name their own parents, which this bridge does not hold, so they keep the link alone.ui/packages/app-shell/src/console/AppContent.tsx: the overlay reads everyformLinkpair (first pair of a field wins, a malformed pair is skipped) into the create's opening values.urlParams.tsdocuments the repeat.ui/apps/console/vite.config.ts: the new module joins theplugin-detail-corechunk group, as that file requires for every module in the/coreclosure.Unblocks objectstack-ai/hotcrm#2753.
Responsibility:
@object-ui/app-shell,@object-ui/plugin-detail).dependsOn; the tab's New did not.dependsOn(HotCRM: order to billing milestone, opportunity to contract).Files to read first (by risk):
ui/packages/app-shell/src/console/AppContent.tsx: theformLinkValueshunk (the URL contract every child create reads).ui/packages/app-shell/src/views/RelatedRecordActionsBridge.tsx: theonCreateseed andopenChildFormhunks.ui/packages/plugin-detail/src/relatedParentScope.ts.Two-minute check: on a record whose related tab lists a child with a
dependsOnrelationship lookup, click Add, then New: the parent shows in its lookup (not "Select ... first"), thedependsOnfield is filled, the URL carries twoformLinkpairs, and Create saves the parent id.Tests
Pins, each a top-level
describefor #37246 in the existing harness of the code it covers:RelatedRecordActionsBridge.createPredicates.test.tsx(the bridge's "+ New" harness): New writesformLink= parent pair thencrm_account:acc-1, with and withoutlookupAutofill; a{ field, param }entry and an expanded reference. Controls: nodependsOn, a parent with no account, a custom page's list: the link alone.AppContent.internalFormRetired-36425.test.tsx(the record-form overlay harness, realModalForm): billing milestone (withlookupAutofill) and contract (without): the relationship lookup is drawn ungated, the opening values hold both, Create posts the parent id and the account. Repeated-pair parse. Control: a lone parent link seeds the parent alone.RelatedList.derivedAddScope-36707.test.tsx(the derived Add harness):relatedCreateSeedOfvalues and its empty cases. Control: the derived picker keeps its 记录页相关页签「添加」关联已有记录时不按客户过滤,且首列「NAME」为空(商机 → 合同) #36707 scope.Red on main, green after, ablation
5e0a09e127): Test Files 3 failed, Tests 5 failed / 26 passed; e.g.expected [ 'crm_sales_order:so-1' ] to deeply equal [ 'crm_sales_order:so-1', …(1) ]. The reworked overlay pins against main'sAppContent.tsx: 3 failed / 7 passed.951db02b5d: Test Files 3 passed, Tests 49 passed.scripts/ablation-replace.mjs, the bridge'srelatedCreateSeedOf(...)call replaced byundefined; the test imports the bridge from source, so nodistleg): anchor 1 to 0, 3 failed / 19 passed (the three seed pins; the controls stayed green); restored, blob after restore == HEAD672ca81d0086,git diff HEADempty.lookup-trigger-gated"Select Account first" for both children. At the form level,dependsOn: ['account']plus alookupAutofillfillingaccount, opened with the parent alone: account filled, the relationship lookup back to "Select…", submit posted the relationship asnull. Opened with the seeded account: the relationship kept its record and the autofill still filled its other targets.Acceptance notes
lookupAutofillfill as an edit of the field it writes, which is what emptied the order in case 1. The seed sets that field before the form opens, so one level down nothing moves. It does not hold one level further: if the seededdependsOnfield is itself a lookup with adependsOnand alookupAutofillof its own (accountdependsOnregion, filled from the account), the opening fill writes region, the clear empties account, and the emptied account empties the order. The child then saves unlinked, which main does too. That transitive value cannot be read off the parent record, so the fix belongs in the form's clear, not in this seed: tracked as Related-tab New, two dependsOn levels deep: the form's dependent-lookup clear wipes the seeded parent pair, so the child saves unlinked #37289. A create opened another way, with a relationship value and an emptydependsOnfield (a URL prefill), meets the same clear.ObjectDataPage's New from a record trail (the "View all" list) writesformLinkwith the parent pair alone, so adependsOnrelationship lookup there meets the same gate. Not changed here: tracked as "View all" → New from a record trail on ObjectDataPage still writes only the parent pair, not the dependsOn seed #37290.Verification
Local suites and type-check at 47db09e (origin/main 1b91538 merged in)
pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-detail/: Test Files 418 passed, 1 skipped; Tests 3954 passed, 18 skipped; exit 0.pnpm --dir ui exec vitest run --maxWorkers=2 packages/app-shell/: Test Files 2438 passed, 1 skipped; Tests 23194 passed, 9 skipped; exit 0.pnpm --filter @object-ui/plugin-detail type-check: exit 0.pnpm --filter @object-ui/app-shell type-check: exit 0, after rebuilding@object-ui/plugin-detail(its/coretypes are read fromdist).pnpm check:new-line-citations(ui): 0 new citations, exit 0.Derived gate families (`dispatch-gates.mjs --commands`, the same list at cbee57c and 47db09e)
pnpm check:dual-build-cjs-loads, reason: PREREQUISITE NOT MET (exit 3), nodist/for packages this diff does not touch (needs a fullpnpm build). CI carries it.pnpm check:type-check-debt, reason: its re-measure queued behind the shared verify lock past its budget (exit 3). The final-head re-run is in the report comment.pnpm --dir ui exec vitest run scripts/: in the report comment (queued on the shared lock while this PR opened).pnpm lintand the full farm: CI.Rework round at 8afea3b (L1 REWORK: M1, S1, S2, N2; main not merged)
relatedCreateSeedOfis dropped (src/index.tsx); the/coreexport stays.core.ts's header no longer says every/corename is also on the root. The changeset declaresClause-②: yes (widening); the level stayspatch, andMetadata-protocol: nonestays.RelatedList.derivedAddScope-36707.test.tsxcovers a two-entrydependsOn. When the parent answers both entries, both fields are seeded. When it answers only one, neither is seeded, and the derived picker offers none either.pluginCoreSubpaths-33581.test.ts: Test Files 4 passed, Tests 53 passed.pnpm --filter @object-ui/plugin-detail type-check: exit 0.pnpm --filter @object-ui/app-shell type-check: exit 0, after rebuilding plugin-detail'sdist.check:type-check-debtincluded.--ranreports 45 run and 1 NOT MEASURED. NOT MEASURED:check:dual-build-cjs-loads(needs a full build, exit 3) andpnpm --dir ui exec vitest run scripts/(lock timeout, exit 99). CI carries both.success(47 success, 11 skipped).Generated by Claude Code