Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Fixed a bug where nested element cards weren’t showing validation errors. ([#18690](https://github.com/craftcms/cms/pull/18690))
- Fixed a bug where read-only Matrix fields in Index mode weren’t respecting the Default Table Columns setting. ([#18684](https://github.com/craftcms/cms/issues/18684))
- Fixed a bug where nested entries could be lost when reverting content from a revision. ([#18691](https://github.com/craftcms/cms/issues/18691))

## 5.9.19 - 2026-04-07

Expand Down
36 changes: 30 additions & 6 deletions src/elements/NestedElementManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1225,12 +1225,36 @@ private function createRevisions(ElementInterface $canonical, ElementInterface $
);

/** @var NestedElementInterface[] $elements */
$elements = $this->nestedElementQuery($canonical)
->siteId($siteIds)
->preferSites([$canonical->siteId])
->unique()
->status(null)
->all();
$elements = [];
$processedElementIds = [];

foreach ($siteIds as $siteId) {
if ($siteId === $canonical->siteId) {
$owner = $canonical;
} else {
$owner = $canonical::find()
->id($canonical->id)
->siteId($siteId)
->status(null)
->one();

if ($owner === null) {
continue;
}
}

$siteElements = $this->nestedElementQuery($owner)
->status(null)
->all();

/** @var NestedElementInterface $element */
foreach ($siteElements as $element) {
if (!isset($processedElementIds[$element->id])) {
$processedElementIds[$element->id] = true;
$elements[] = $element;
}
}
}

$revisionsService = Craft::$app->getRevisions();
$elementRevisionIds = [];
Expand Down
Loading