Skip to content

Commit b8db7a7

Browse files
committed
Cache getPrev() and getNext() ID queries
1 parent 255dbe8 commit b8db7a7

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Release Notes for Craft CMS 4
22

3+
## Unreleased
4+
5+
- Fixed a bug where elements’ `getPrev()` and `getNext()` methods could cause duplicate queries. ([#16329](https://github.com/craftcms/cms/discussions/16329))
6+
37
## 4.13.6 - 2024-12-10
48

59
- Fixed a bug where blank user group descriptions weren’t getting omitted from project config data. ([#16272](https://github.com/craftcms/cms/pull/16272))

src/base/Element.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5500,7 +5500,7 @@ private function _getRelativeElement(mixed $criteria, int $dir): ?ElementInterfa
55005500
}
55015501

55025502
/** @var ElementQuery $query */
5503-
$elementIds = $query->ids();
5503+
$elementIds = $query->cache()->ids();
55045504
$key = array_search($this->getCanonicalId(), $elementIds, false);
55055505

55065506
if ($key === false || !isset($elementIds[$key + $dir])) {

0 commit comments

Comments
 (0)