[6.x] Fix uri index for new entries in orderable collections - #15189
Open
duncanmcclean wants to merge 1 commit into
Open
[6.x] Fix uri index for new entries in orderable collections#15189duncanmcclean wants to merge 1 commit into
uri index for new entries in orderable collections#15189duncanmcclean wants to merge 1 commit into
Conversation
`uri` was being updated before `collectionHandle` and `site` in `CollectionEntriesStore::storeIndexes()`. entries in orderable collections aren't written to the tree file, so `CollectionStructure::validateTree()` queries the collection's entries to reconcile it - and that query couldn't see the entry being saved, leaving `null` cached as its uri (and `1` as its order) until the entry was saved a second time. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
uri index for new entries in orderable collections
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request fixes an issue where new entries in an orderable collection (a structure with a
max_depthof 1) would 404 on the front end until they were saved a second time.This was happening because
uriwas being updated beforecollectionHandleandsiteinCollectionEntriesStore::storeIndexes(). Entries in orderable collections never get written to the tree file, soCollectionStructure::validateTree()reconciles the tree by querying the collection's entries. At the point theuriindex was updated, the entry being saved wasn't yet visible to that query, so no page was found for it andnullgot cached as its uri. Saving a second time worked because the entry was in the other indexes by then.This PR fixes it by moving
uriafter the indexes that query relies on, alongsideparent, which is resolved from the structure too. This also fixes theorderindex, which was landing on1for every new entry.Fixes #11534