Skip to content

fix(data): remove redundant user query in FindByOrg#2946

Draft
matiasinsaurralde wants to merge 1 commit intochainloop-dev:mainfrom
matiasinsaurralde:fix/membership-remove-redundant-user-fetch
Draft

fix(data): remove redundant user query in FindByOrg#2946
matiasinsaurralde wants to merge 1 commit intochainloop-dev:mainfrom
matiasinsaurralde:fix/membership-remove-redundant-user-fetch

Conversation

@matiasinsaurralde
Copy link
Copy Markdown
Contributor

Summary

FindByOrg was issuing a second User.Query() to fetch user data that had already been loaded via .WithUser() in the initial membership query. The extra round-trip and manual map-building were dead code — entMembershipToBiz already populates User from m.Edges.User.

Removed the redundant query and simplified the function to return entMembershipsToBiz(memberships) directly.

Added explicit User != nil assertions to TestByOrg to lock in the behavior.

Memberships were already loaded with .WithUser(), so the subsequent
User.Query() call fetched the same data a second time. Remove the dead
code and rely on the eager-loaded edges directly.

Signed-off-by: Matías Insaurralde <matias@chainloop.dev>
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.

1 participant