Fix unguarded codequalityReportsComparer.status access and nil pipeline guard
What and why
This MR addresses issue #594017.
When a merge request has no diff_head_pipeline, the backend resolver returns null and the frontend stop-polling condition throws a TypeError because it accesses codequalityReportsComparer.status without guarding against null. This MR fixes the crash by using optional chaining / nil-safe access in the stop-polling logic.
What this MR changes
Files updated:
app/assets/javascripts/diffs/components/app.vueapp/assets/javascripts/groups/show/components/app.vueapp/assets/javascripts/groups_projects/components/tabs_with_list.vuespec/frontend/groups_projects/components/tabs_with_list_spec.js
Implementation notes
- Updated the stop-polling condition(s) to safely handle
codequalityReportsComparer === null(nil-safe access with optional chaining), so the UI keeps polling instead of throwing. - Added/updated a regression spec around the behavior covered by
tabs_with_list_spec.js.
How to verify
- Review the changed stop-polling condition(s) in the Vue components to confirm all accesses to
codequalityReportsComparerare nil-safe. - Run the relevant frontend/unit tests for the touched area (includes
spec/frontend/groups_projects/components/tabs_with_list_spec.js) and ensure they pass. - Confirm the MR pipeline is green in GitLab.
Contribution standards
This MR follows GitLab’s contributor guidance for merge requests:
Closes #594017
Edited by Olayinka Vaughan