Commit 7c5af3ea authored by Douwe Maan's avatar Douwe Maan

More aggressively preload on merge request and issue index pages

parent aea8baed
...@@ -10,11 +10,11 @@ module IssuableCollections ...@@ -10,11 +10,11 @@ module IssuableCollections
private private
def issues_collection def issues_collection
issues_finder.execute issues_finder.execute.preload(:project, :author, :assignee, :labels, :milestone, project: :namespace)
end end
def merge_requests_collection def merge_requests_collection
merge_requests_finder.execute merge_requests_finder.execute.preload(:source_project, :target_project, :author, :assignee, :labels, :milestone, :merge_request_diff, target_project: :namespace)
end end
def issues_finder def issues_finder
......
...@@ -7,7 +7,6 @@ module IssuesAction ...@@ -7,7 +7,6 @@ module IssuesAction
@issues = issues_collection @issues = issues_collection
.non_archived .non_archived
.preload(:author, :project)
.page(params[:page]) .page(params[:page])
respond_to do |format| respond_to do |format|
......
...@@ -7,7 +7,6 @@ module MergeRequestsAction ...@@ -7,7 +7,6 @@ module MergeRequestsAction
@merge_requests = merge_requests_collection @merge_requests = merge_requests_collection
.non_archived .non_archived
.preload(:author, :target_project)
.page(params[:page]) .page(params[:page])
end end
end end
...@@ -38,7 +38,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -38,7 +38,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def index def index
@merge_requests = merge_requests_collection @merge_requests = merge_requests_collection
@merge_requests = @merge_requests.page(params[:page]) @merge_requests = @merge_requests.page(params[:page])
@merge_requests = @merge_requests.preload(:target_project)
if params[:label_name].present? if params[:label_name].present?
labels_params = { project_id: @project.id, title: params[:label_name] } labels_params = { project_id: @project.id, title: params[:label_name] }
......
...@@ -171,9 +171,11 @@ module IssuablesHelper ...@@ -171,9 +171,11 @@ module IssuablesHelper
def issuables_count_for_state(issuable_type, state) def issuables_count_for_state(issuable_type, state)
issuables_finder = public_send("#{issuable_type}_finder") issuables_finder = public_send("#{issuable_type}_finder")
issuables_finder.params[:state] = state
params = issuables_finder.params.merge(state: state)
finder = issuables_finder.class.new(issuables_finder.current_user, params)
issuables_finder.execute.page(1).total_count finder.execute.page(1).total_count
end end
IRRELEVANT_PARAMS_FOR_CACHE_KEY = %i[utf8 sort page] IRRELEVANT_PARAMS_FOR_CACHE_KEY = %i[utf8 sort page]
......
...@@ -54,15 +54,18 @@ ...@@ -54,15 +54,18 @@
= link_to namespace_project_commits_path(merge_request.project.namespace, merge_request.project, merge_request.target_branch) do = link_to namespace_project_commits_path(merge_request.project.namespace, merge_request.project, merge_request.target_branch) do
= icon('code-fork') = icon('code-fork')
= merge_request.target_branch = merge_request.target_branch
- if merge_request.milestone - if merge_request.milestone
&nbsp; &nbsp;
= link_to namespace_project_merge_requests_path(merge_request.project.namespace, merge_request.project, milestone_title: merge_request.milestone.title) do = link_to namespace_project_merge_requests_path(merge_request.project.namespace, merge_request.project, milestone_title: merge_request.milestone.title) do
= icon('clock-o') = icon('clock-o')
= merge_request.milestone.title = merge_request.milestone.title
- if merge_request.labels.any? - if merge_request.labels.any?
&nbsp; &nbsp;
- merge_request.labels.each do |label| - merge_request.labels.each do |label|
= link_to_label(label, subject: merge_request.project, type: :merge_request) = link_to_label(label, subject: merge_request.project, type: :merge_request)
- if merge_request.tasks? - if merge_request.tasks?
&nbsp; &nbsp;
%span.task-status %span.task-status
......
---
title: More aggressively preload on merge request and issue index pages
merge_request:
author:
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment