DAST scan form triggers unnecessary API requests
In the DAST scan form, with the dastBranchSelection
feature flag enabled, we now have a branch selector that leverages the RefSelector
component. While the feature works well overall, changing any input's value seems to result in the RefSelector
component unncessarily re-fetching branches.
It seems to be due to the fact the the enabled-ref-types
array is declared in the template directly: https://gitlab.com/gitlab-org/gitlab/-/blob/d45b120c819438a5e7d5cb43738e80c76652f893/ee/app/assets/javascripts/on_demand_scans/components/on_demand_scans_form.vue#L448. This results in RefSelector
's watcher being triggered whenever a change occurs in OnDemandScansForm
.
The fix should be rather simple: declare the array in the component's option rather than in its template to make sure we're always passing the same object to RefSelector
and not replacing the array over and over.