fix: correct collection item search and reference loading#350
Merged
tristan-mouchet merged 1 commit intoJun 12, 2026
Merged
Conversation
Searching a collection's items matched values across every collection (the values table has no collection_id), producing a huge id set that overflowed the request URL and failed the count query. Filter through an embedded inner join on collection_item_values instead, which scopes matches to the collection via the parent FK and removes the id list. Also fix the top-items-per-collection fallback: a single shared query with a global limit let an early-sorting collection consume the whole row budget and starve later collections to zero rows, breaking reference-field lookups. Fetch each collection's top N independently.
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.
Summary
Fixes two issues in collection item fetching: searching a collection's records could fail with a "Failed to count collection items" error, and reference-field text could fail to load on the canvas because some referenced collections received zero items.
Changes
collection_item_valuesinstead of collecting matching item ids and using.in('id', ...). The values table has nocollection_id, so the old approach matched values across every collection and built an id list large enough to overflow the request URL and fail the count query. The embedded join scopes matches to the collection via the parent FK.Test plan