Eager load project creators for project dashboards
This solves an N+1 query problem where for every project we'd query the creator separately just to figure out what avatar to display.
This commit is contained in:
parent
ab738645a7
commit
bd08fff6c5
|
@ -45,8 +45,10 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
|
|||
end
|
||||
|
||||
def load_projects(finder_params)
|
||||
ProjectsFinder.new(params: finder_params, current_user: current_user)
|
||||
.execute.includes(:route, namespace: :route)
|
||||
ProjectsFinder
|
||||
.new(params: finder_params, current_user: current_user)
|
||||
.execute
|
||||
.includes(:route, :creator, namespace: :route)
|
||||
end
|
||||
|
||||
def load_events
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Eager load project creators for project dashboards
|
||||
merge_request:
|
||||
author:
|
Loading…
Reference in New Issue