Fix N+1 query in opportunities board#150
Closed
NeloNew wants to merge 1 commit intorelaticle:mainfrom
Closed
Conversation
NeloNew
added a commit
to NeloNew/relaticle
that referenced
this pull request
Feb 23, 2026
Addresses Copilot's feedback on PR relaticle#146 by applying eager loading optimization consistently across all resources that implement HasCustomFields. Changes: - Added ->withCustomFieldValues() to PeopleResource - Added ->withCustomFieldValues() to CompanyResource - Added ->withCustomFieldValues() to OpportunityResource - Added ->withCustomFieldValues() to TaskResource - Added ->withCustomFieldValues() to NoteResource Performance impact: - Before: 10-20+ queries per page load (one per record) - After: 1-3 queries total (batch loaded) Related: - Supersedes PR relaticle#146 (PeopleResource only) - Supersedes PR relaticle#150 (OpportunityResource only) - Resolves RELATICLE-CRM-39 - Resolves RELATICLE-CRM-38 Tests: 722 passed, 5 skipped
Contributor
Author
|
Superseded by comprehensive fix in PR #151 which applies the N+1 optimization across all 5 resources (People, Company, Opportunity, Task, Note) as suggested by Copilot. This ensures consistent performance optimization across all entity types that implement HasCustomFields. |
ManukMinasyan
pushed a commit
that referenced
this pull request
Feb 23, 2026
Addresses Copilot's feedback on PR #146 by applying eager loading optimization consistently across all resources that implement HasCustomFields. Changes: - Added ->withCustomFieldValues() to PeopleResource - Added ->withCustomFieldValues() to CompanyResource - Added ->withCustomFieldValues() to OpportunityResource - Added ->withCustomFieldValues() to TaskResource - Added ->withCustomFieldValues() to NoteResource Performance impact: - Before: 10-20+ queries per page load (one per record) - After: 1-3 queries total (batch loaded) Related: - Supersedes PR #146 (PeopleResource only) - Supersedes PR #150 (OpportunityResource only) - Resolves RELATICLE-CRM-39 - Resolves RELATICLE-CRM-38 Tests: 722 passed, 5 skipped
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.
Problem
Sentry detected an N+1 query issue (RELATICLE-CRM-38) when loading the opportunities board. The board was loading custom field values individually for each opportunity card.
Solution
Added
->withCustomFieldValues()to the board query to eager load all custom field relationships in a single query.Performance Impact
Related Issues
Testing