Skip to content

ui: wait for the zones before building the menu on first login - #14920

Open
jmsperu wants to merge 1 commit into
apache:mainfrom
jmsperu:fix-14847-ui-zones-race
Open

jmsperu wants to merge 1 commit into
apache:mainfrom
jmsperu:fix-14847-ui-zones-race

Conversation

@jmsperu

@jmsperu jmsperu commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Fixes: #14847

On a fresh login GetInfo starts listZones and listApis in parallel and generates the routes as soon as listApis (and the capabilities) return. If listZones has not returned yet, the zones in the store are still the initial value {}, and the menu checks that call store.getters.zones.filter(...) throw zones.filter is not a function. The UI stays empty until a reload, when the zones come from local storage.

This PR:

  • starts the zones state as an empty list, the same type that SET_ZONES and the cached value use
  • generates the routes only after the zones are stored, so the menu items that depend on zones are not hidden on first login

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

How Has This Been Tested?

In a browser, with the UI dev server (npm run serve) pointed at a 4.22.1.1 management server, logging in as a user whose role is of type User with a short allow-list (listApis, listZones, listSecurityGroups, listUsers, listCapabilities, listLdapConfigurations, listNetworkServiceProviders, cloudianIsEnabled, listNetworks, listVPCs, then * deny). Local storage and cookies were cleared before each login.

The race is timing dependent, so to make it certain the listZones request was held back for 4 seconds in the browser.

  • Without the fix: the UI stays on the login page with no menu, and the console shows TypeError: store.getters.zones.filter is not a function at network.js from GenerateRoutes, as in the issue.
  • With the fix: the dashboard loads after the zones arrive, the menu shows Dashboard, Network (Guest Networks, VPC), Zones and API Docs, and there is no such error.
  • With the fix and no delay: login works as before.

vue-cli-service lint reports no errors for the changed file.

On a fresh login the routes were generated as soon as listApis returned,
without waiting for listZones. The zones in the store were still the initial
value, an object, so the menu checks that call zones.filter() failed and the
UI stayed empty until a reload.

Start with an empty list and generate the routes only after the zones are
stored.

Fixes: apache#14847
@codecov

codecov Bot commented Nov 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 3.86%. Comparing base (caf1091) to head (b61c6a7).
⚠️ Report is 9 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (caf1091) and HEAD (b61c6a7). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (caf1091) HEAD (b61c6a7)
unittests 1 0
Additional details and impacted files
@@              Coverage Diff              @@
##               main   #14920       +/-   ##
=============================================
- Coverage     20.80%    3.86%   -16.95%     
=============================================
  Files          6053      494     -5559     
  Lines        548466    42888   -505578     
  Branches      73283     8141    -65142     
=============================================
- Hits         114129     1657   -112472     
+ Misses       420977    40999   -379978     
+ Partials      13360      232    -13128     
Flag Coverage Δ
uitests 3.86% <ø> (ø)
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI: store.getters.zones.filter is not a function on first login for User-type roles (race between listZones and listApis)

1 participant