fix: don't fail the grid when relationship resolution exceeds the query value limit - #3143
Merged
Merged
Conversation
…ry value limit Tables with wide relationships make the API exceed its own 500 value limit while resolving them for a full page of rows, failing the whole listRows request and rendering a 400 error page instead of the table. Retry the page without relationship selects when that happens, then fill relationships in over chunks of 10 rows. Rows whose chunk still fails render without relationship data instead of taking down the page. Tables that load today are unaffected - the fallback only runs after a 'greater than N values' failure.
Contributor
Greptile SummaryThe PR adds a relationship-resolution fallback for database grids.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (2): Last reviewed commit: "fix: materialize filter queries so the r..." | Re-trigger Greptile |
loadGridRows builds its queries twice on the fallback path, and loadPage passed a Map iterator that the first build exhausted - the retry then ran without the active filters and paged in rows outside them.
ArnabChatterjee20k
approved these changes
Jul 31, 2026
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.
What
Opening a table (or collection) whose rows have wide relationships renders a full-page
400 Invalid query: Query on attribute has greater than 500 values: $idinstead of the grid.The console never sends that
$idquery. The grid load only sendsQuery.limit(50),Query.offset(0),Query.orderDesc('')and the per-relationshipQuery.select(['<rel>.*'])wildcards frombuildWildcardEntitiesQuery. The oversized$idquery is built inside the API while resolving relationships for the whole page of rows, and tripsAPP_DATABASE_QUERY_MAX_VALUES = 500.Reported by a customer on project
679f1c1200137e7a62e6(DB16), reproduced locally against cloud.How
New
loadGridRowshelper in$database/store:greater than N valuesfailure, retries the same page withQuery.select(['*'])instead of therel.*selects, so nothing gets resolved and the request goes through.Query.equal('$id', chunk)+ wildcards) in parallel and merges by$id, preserving order. A chunk that still fails leaves those rows unpopulated rather than failing the page.Wired into the table page load, the collection page load, and both paging paths in
spreadsheet.svelte— otherwise the page would load and then break on the next page.Note
This is a mitigation, not the fix. The real fix is server side: chunk the internal
$idquery used for relationship resolution, or run it under the higher internal limit. Worth tracking separately so we can drop this fallback later.Test plan
bun run format && bun run check && bun run lint && bun run test:unit