Make dependency row props optional when data is absent
What does this MR do and why?
The dependency list shows dependencies fetched over REST. Two props fail validation when the data lacks certain fields. Dependencies fetched via REST have no hasDependencyPaths field, and rows without a license scan have no licenses field. The child components dependency_location.vue and dependency_license_links.vue required both props, causing warnings on render.
The warnings are: prop "hasDependencyPaths". Expected Boolean, got Undefined and prop "licenses". Expected Array, got Undefined.
Fix: the hasDependencyPaths prop now defaults to false (it only guards a v-if). The licenses prop now defaults to [] (the component already has guards for Array.isArray).
Changes made:
ee/app/assets/javascripts/dependencies/components/dependency_location.vueee/app/assets/javascripts/dependencies/components/dependency_license_links.vue
How to set up and validate locally
- Go to Secure > Dependency list in a project with dependencies.
- Verify the list shows dependencies without errors.
- Check the browser console shows no
[Vue warn]line for these warnings.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
- I have evaluated the MR acceptance checklist for this MR.
References
- Addresses one entry of #628901 (browser console error catalogue, section C: Vue warnings)
- Warnings surfaced by !255207 (closed) (feature specs fail on console errors)
- Sibling fixes from the same section: !255388 (merged), !255389 (merged), !255390 (merged), !255391 (closed), !255392 (merged), !255393 (closed), !255394 (merged), !255396 (merged), !255397 (merged), !255398 (merged)