Commit 0344e083 authored by Sean McGivern's avatar Sean McGivern

Only load what we need when visiting MR diffs page

The instance variables set in this action are only used by the JSON
response. Visiting `merge_requests/:iid/diffs` in a browser always loads
the `show` action, so we don't need to find an MR diff, or an
environment, in that case.
parent 7a974905
...@@ -97,6 +97,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -97,6 +97,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def diffs def diffs
apply_diff_view_cookie! apply_diff_view_cookie!
respond_to do |format|
format.html { define_discussion_vars }
format.json do
@merge_request_diff = @merge_request_diff =
if params[:diff_id] if params[:diff_id]
@merge_request.merge_request_diffs.viewable.find(params[:diff_id]) @merge_request.merge_request_diffs.viewable.find(params[:diff_id])
...@@ -119,9 +122,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -119,9 +122,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@environment = @merge_request.environments_for(current_user).last @environment = @merge_request.environments_for(current_user).last
respond_to do |format|
format.html { define_discussion_vars }
format.json do
if @start_sha if @start_sha
compared_diff_version compared_diff_version
else else
......
---
title: Speed up initial rendering of MR diffs page
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