Skip to content

Refactor weight select

Clement Ho requested to merge refactor-weight-select into master

What does this MR do?

Remove dead code in WeightSelect that is not used in any current execution paths. Considering this code is tightly coupled with glDropdown and there is lack of documentation for that, the chance of these unused execution paths being used again is slim to none. As a result, I am recommending that we remove this dead code. Below is an analysis of how it was determined to be dead code.

Here are the different ways WeightSelect is invoked in our codebase

graph TD;
    A["boards/components/weight_select.vue:L53"] --> WeightSelect.js;
    B["pages/projects/issues/form.js:L17"] --> WeightSelect.js;
    

Here are the different pages that invoke WeightSelect

graph TD;
    projects:issues:edit --> WeightSelect.js;
    projects:issues:new --> WeightSelect.js;
    projects:boards:index --> WeightSelect.js;

Here is how the execution paths work in the clicked event handler of WeightSelect's glDropdown as seen on line 40

graph LR;

  style A stroke:#e74c3c,stroke-width:4px;
  style C stroke:#e74c3c,stroke-width:4px;
  weightSelect.clicked -. triggers this path in projects:boards:index .-> options.handleClick;
  weightSelect.clicked  -. not triggered in any scenarios .-> A["$(dropdown).is('.js-filter-submit')"];
  weightSelect.clicked  -. triggers this path in projects:issues:new and projects:issues:edit .-> B["$dropdown.is('.js-issuable-form-weight')"]
  weightSelect.clicked  -. not triggered in any scenarios .-> C[else];
   

Note: Red border indicates dead code

Are there points in the code the reviewer needs to double check?

Shouldn't be

Why was this MR needed?

~"technical debt"

Screenshots (if relevant)

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/4923

Edited by Clement Ho

Merge request reports