mwdb-core icon indicating copy to clipboard operation
mwdb-core copied to clipboard

Fix: don't use joined relationship for 'favorite' parameter

Open psrok1 opened this issue 1 year ago • 0 comments

Your checklist for this pull request

  • [x] I've read the contributing guideline.
  • [x] I've tested my changes by building and running the project, and testing changed functionality (if applicable)
  • [x] I've added automated tests for my change (if applicable, optional)
  • [ ] I've updated documentation to reflect my change (if applicable)

What is the current behaviour?

Followers are joined for every Object instance and Favorites are joined for every User instance. It's completely unnecessary and has negative impact on query performance.

Joined relationships in objects should be used only for fields included in listing schemas like ObjectListItemResponseSchema to avoid N+1 problem.

What is the new behaviour?

Favorites/Followers are loaded lazily.

psrok1 avatar Jul 03 '24 10:07 psrok1