Skip to content

fix(drive-integration): link new Add Entry as child of selected parent [INTEG-4524] - #11111

Merged
JuliRossi merged 6 commits into
INTEG-4524-add-entry-form-uifrom
INTEG-4524-child-reference-logic
Jul 30, 2026
Merged

fix(drive-integration): link new Add Entry as child of selected parent [INTEG-4524]#11111
JuliRossi merged 6 commits into
INTEG-4524-add-entry-form-uifrom
INTEG-4524-child-reference-logic

Conversation

@JuliRossi

Copy link
Copy Markdown
Collaborator

Summary

  • Flip Add Entry reference semantics: the new entry is a child of an existing parent (not a parent pointing at an existing entry).
  • Reference fields come from the parent content type; __ref / sourceEntryIds are written on the parent; edge is from=parent → to=child.
  • Single Link fields replace any prior child; Array fields append.
  • Disable Yes only when no existing parent content type has an Entry reference field.
  • Stacked on feat(drive-integration): Replace Add Entry wizard with single-screen form [INTEG-4524] #11110 (UI form refactor).

New reference logic

flowchart TD
  A[Select content type for new entry] --> B{Any existing parent<br/>has Entry reference fields?}
  B -->|No| C[Yes disabled — only No allowed]
  B -->|Yes| D{Should this new entry be a<br/>reference of an existing entry?}
  D -->|No| E[Map fields on new entry only]
  D -->|Yes| F[Select parent entry]
  F --> G{Parent has how many<br/>Entry reference fields?}
  G -->|0| H[Save disabled]
  G -->|1| I[Auto-pick that field]
  G -->|2+| J[Select parent field]
  I --> K[Save]
  J --> K
  K --> L[Create new child entry]
  L --> M{Parent field type}
  M -->|Link| N[Replace parent field value,<br/>sourceEntryIds, and edges]
  M -->|Array| O[Append child to parent field,<br/>sourceEntryIds, and edges]
  N --> P["Edge: from=parent → to=child"]
  O --> P
Loading

Before vs after

Before (wrong) After
Who holds __ref New entry Parent entry
Reference fields shown New content type Parent content type
Graph edge from=new → to=existing from=parent → to=child
Yes disabled when New CT has no ref fields No parent can accept a ref

Test plan

  • Add entry No → saves standalone entry with mapped fields
  • Add entry Yes with parent that has one Link field → links as child without showing field select
  • Add entry Yes with parent that has multiple ref fields → field select appears; Save requires a choice
  • Parent already has a filled single Link → creating a new child replaces the old reference on create
  • Parent Array reference → new child is appended
  • When every existing entry’s CT has no Entry refs → Yes is disabled, No still works
  • New entry CT with no ref fields (e.g. Component/Tag) but parents can accept refs → Yes stays enabled

Made with Cursor

@JuliRossi
JuliRossi requested a review from a team as a code owner July 21, 2026 19:51

@FBanfi Franco Banfi (FBanfi) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Left a comment that I don't think would end up happing in practice but that may be worth addressing just in case!

JuliRossi and others added 4 commits July 24, 2026 12:09
… path + rename fmIdx

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ds, fieldMappings, and edges consistent

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… double Object.keys call

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…zedField, drop unnecessary casts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@JuliRossi
JuliRossi force-pushed the INTEG-4524-child-reference-logic branch from 366ff43 to 17d6ca7 Compare July 24, 2026 18:17
@JuliRossi JuliRossi added do not merge Don't merge this PR until this label is removed and removed do not merge Don't merge this PR until this label is removed labels Jul 27, 2026
@JuliRossi
JuliRossi merged commit a8fa15e into INTEG-4524-add-entry-form-ui Jul 30, 2026
13 checks passed
@JuliRossi
JuliRossi deleted the INTEG-4524-child-reference-logic branch July 30, 2026 16:57
JuliRossi added a commit that referenced this pull request Jul 30, 2026
…form [INTEG-4524] (#11110)

* refactor: replace AddEntryWizard with AddEntryForm in EditModal

This update refactors the EditModal component to utilize the new AddEntryForm for adding entries, simplifying the entry addition process. The AddEntryWizard has been removed, and the related state management has been adjusted accordingly. The AddEntryForm now handles the entry creation logic, including content type selection and field mapping, enhancing the user experience. Additionally, the AddEntryForm is integrated with the existing modal controls for better navigation and state management.

* fix(drive-integration): disable Yes radio and block save when content type has no reference fields

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(drive-integration): add integration test for Save wire in AddEntryForm

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(drive-integration): rename Back to Cancel in AddEntryForm — it is a cancel action, not step navigation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(drive-integration): link new Add Entry as child of selected parent [INTEG-4524] (#11111)

* updating logic

* refactor(AddEntryForm): improve child reference handling and UI logic

* test(drive-integration): add coverage for new-entry fieldMapping push path + rename fmIdx

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(drive-integration): guard against parentId undefined to keep fields, fieldMappings, and edges consistent

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(drive-integration): remove dead ?? 'Link' fallback and avoid double Object.keys call

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(drive-integration): tighten ParentRefField types, use LocalizedField, drop unnecessary casts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants