Avoid making initial request when the branch is empty in the merge request compare page

Summary

When we want to create a new merge request, the source_branch and the target_branch can be empty (or it might be after https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/32701).

Nevertheless, when we load the compare page we make a request that doesn't return anything because the param we're using it's empty.

Improvements

We can avoid those extra queries when the param we're passing is not present.

Involved components

I think:

  • app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/target_branch_dropdown.js
  • app/assets/javascripts/pages/projects/merge_requests/creations/new/compare.js
  • app/assets/javascripts/compare_autocomplete.js
Edited Jul 01, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading