Skip to content

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

Merged
matiasinsaurralde merged 1 commit into
chainloop-dev:mainfrom
matiasinsaurralde:fix/membership-remove-redundant-user-fetch
Mar 31, 2026
Merged

fix(data): remove redundant user query in FindByOrg#2946
matiasinsaurralde merged 1 commit into
chainloop-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>
@matiasinsaurralde matiasinsaurralde marked this pull request as ready for review March 30, 2026 01:49

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

@matiasinsaurralde matiasinsaurralde requested a review from a team March 30, 2026 03:19
@matiasinsaurralde matiasinsaurralde merged commit 094e78c into chainloop-dev:main Mar 31, 2026
15 checks passed
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.

2 participants