Bug description
Statamic\Entries\Entry::updateChildPageUris() contains an empty-check that can never be true:
// vendor/statamic/cms/src/Entries/Entry.php (6.x:511, 5.x:482)
if (empty($ids = $page->flattenedPages()->pluck('id'))) {
return;
}
// vendor/statamic/eloquent-driver/src/Entries/EntryRepository.php:98
public function updateUris($collection, $ids = null)
{
$ids = collect($ids);
$collection->queryEntries()
->when($ids->isNotEmpty(), fn ($query) => $query->whereIn('id', $ids))
->get()
->each(fn ($entry) => $entry->model()->update(['uri' => $entry->uri()]));
}
With an empty $ids, $ids->isNotEmpty() is false → whereIn is skipped → every entry in the collection is loaded, each URI is recomputed (walking ancestors), and a per-entry UPDATE is issued.
Observed performance impact on a non-trivial project (44 locales, news collection with 6k+ entries): every saveQuietly() on a structured news entry spends more than 26 seconds in updateChildPageUris with a ~650 MB.
How to reproduce
- Laravel + Statamic v6 + statamic/eloquent-driver:"^5.0".
- Create a structured collection
- Seed entries
- Pick a leaf entry $leaf that has NO child pages in the structure. Confirm: $leaf->page()->flattenedPages()->count() === 0.
- Mutate the slug (any change that passes shouldUpdateUris()):
Environment
- Statamic version: 6.14.0 (also present on 5.x branch line 482)
- Laravel version: 12.56.0
- PHP version: 8.4.19
- statamic/eloquent-driver: 5.6.3 (entries driver set to eloquent; collections driver file)
- DB: MySQL 8
- OS: macOS 26.4
Installation
Existing Laravel app
Bug description
Statamic\Entries\Entry::updateChildPageUris() contains an empty-check that can never be true:
With an empty $ids, $ids->isNotEmpty() is false → whereIn is skipped → every entry in the collection is loaded, each URI is recomputed (walking ancestors), and a per-entry UPDATE is issued.
Observed performance impact on a non-trivial project (44 locales, news collection with 6k+ entries): every saveQuietly() on a structured news entry spends more than 26 seconds in updateChildPageUris with a ~650 MB.
How to reproduce
Environment
Installation
Existing Laravel app