Skip to content

ui: deploy form fetches data twice #10832

@shwstppr

Description

@shwstppr

problem

When accessing the "Deploy VM" wizard (and potentially other forms), most data is fetched twice. This appears to be caused by the OwnershipSelection component, which resets and re-fetches data upon creation. As a result, redundant API calls are triggered, impacting performance and potentially user experience.

Added the following logs to check,

diff --git a/ui/src/views/compute/DeployVM.vue b/ui/src/views/compute/DeployVM.vue
index c6b6842bb6..d0eeff36c3 100644
--- a/ui/src/views/compute/DeployVM.vue
+++ b/ui/src/views/compute/DeployVM.vue
@@ -1723,6 +1723,7 @@ export default {
       })
     },
     async fetchData () {
+      console.log(new Date().toLocaleString(), 'T3st - fetching data')
       const zones = await this.fetchZoneByQuery()
       if (zones && zones.length === 1) {
         this.selectedZone = zones[0]
@@ -2327,6 +2328,7 @@ export default {
         this.owner.domainid = null
         this.owner.projectid = OwnerOptions.selectedProject
       }
+      console.log(new Date().toLocaleString(), 'T3st - resetting data')
       this.resetData()
     },
     fetchZones (zoneId, listZoneAllow) {
deploy-twice-fetch-data.mp4

versions

4.20, maybe others which have ownership selection UI

The steps to reproduce the bug

  1. Open deploy vm wizard
  2. Check many list APIs being called twice

What to do about it?

Do not reset data on initial creation of the components

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    Todo

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions