Skip to content

[6.x] Fix structured entry order going stale when other entries shift - #15816

Open
mynetx wants to merge 1 commit into
statamic:6.xfrom
mynetx:fix/structured-entry-order-shifted
Open

mynetx wants to merge 1 commit into
statamic:6.xfrom
mynetx:fix/structured-entry-order-shifted

Conversation

@mynetx

@mynetx mynetx commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

When a collection tree is saved, only the entries that were moved or added get their order updated. But an entry's order is its position in the whole tree, so anything that just gets pushed down keeps its old number. Add a child to the first page and every page after it is now off by one, and you get ties and a front end sort that no longer matches the tree. With the Eloquent driver that's stored in entries.order, so it builds up over time.

This also updates entries whose position in the tree changed, including after a removal.

That means a change near the top of a big tree updates more entries than before, which is needed since their order really was wrong. To keep it cheap, the order and parent indexes are now written to the cache once per save instead of once per entry. On a 1,000 entry tree that took a save from 265ms to about 155ms.

Fixes #15799

🤖 Generated with Claude Code

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

Structured entry order goes stale for entries shifted, but not moved, by a tree change

1 participant