Skip to content

Editing nested elements when owner is new for site (and still a provisional draft)#15898

Merged
brandonkelly merged 8 commits into5.xfrom
bugfix/editing-nested-entries-in-owners-new-site
Oct 17, 2024
Merged

Editing nested elements when owner is new for site (and still a provisional draft)#15898
brandonkelly merged 8 commits into5.xfrom
bugfix/editing-nested-entries-in-owners-new-site

Conversation

@i-just
Copy link
Copy Markdown
Contributor

@i-just i-just commented Oct 16, 2024

Description

Replication steps:

  • have 2 sites set up
  • have a section enabled for both sites, with propagation set to custom (let each entry choose) & an entry type with a matrix field in cards view mode, propagation set to all
  • create an entry for site1 with at least 1 nested entry in the matrix field & save
  • edit the entry and enable it for site2 - don’t save; stay in the provisional draft
  • go to site2 and try to open the nested entry - you’ll get an error: “Invalid owner ID”
  • if you fully save the changes, all is fine again

Problem:
The ownership of the nested elements is grabbed and assigned correctly when displaying the owner element, but when you double-click on the card (or use the Edit entry action), only the primary ownership data is taken into consideration, but the primary owner (the canonical element) doesn’t yet exist for that site - only the provisional draft does.

Solution:
Since we have the right owner data when displaying the page, add it to the card’s data attributes (along with field id) and use it when initialising the element editor and querying for the element.

Related issues

n/a

@i-just i-just requested a review from brandonkelly October 16, 2024 12:37
@brandonkelly brandonkelly merged commit 3dcb891 into 5.x Oct 17, 2024
@brandonkelly brandonkelly deleted the bugfix/editing-nested-entries-in-owners-new-site branch October 17, 2024 18:45
brandonkelly added a commit that referenced this pull request Oct 20, 2024
ownerId was no longer getting set via setAttributesFromRequest(), after #15898
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.

2 participants