PERF: Fix N+1 queries in SiteSerialier. (#14365)

`SiteSerializer#groups` loads `Group#flair_upload` for each group so
we need to eagerload this.

Follow-up to e8a9917db1
This commit is contained in:
Alan Guo Xiang Tan 2021-09-17 10:34:04 +08:00 committed by GitHub
parent da88cad648
commit 903439a14e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -124,7 +124,9 @@ class Site
end
def groups
Group.visible_groups(@guardian.user, "name ASC", include_everyone: true)
Group
.visible_groups(@guardian.user, "name ASC", include_everyone: true)
.includes(:flair_upload)
end
def archetypes