fix: keep fleet stats stable during status and search filtering#13951
Conversation
Signed-off-by: ashnaaseth2325-oss <ashnaaseth2325@gmail.com>
✅ Deploy Preview for kubestellarconsole ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
👋 Hey @ashnaaseth2325-oss — thanks for opening this PR!
This is an automated message. |
There was a problem hiding this comment.
Pull request overview
Refactors the cluster filtering pipeline in ClusterLocations so that fleet-level stats tiles remain stable when users apply status chip or local search filters. A new baseClusters memo holds the global/reachability-scoped fleet, while the existing clusters memo layers on UI filters used only by the map markers and cluster list.
Changes:
- Split filtering into two memos:
baseClusters(global scope) andclusters(UI filters layered on top). - Recomputed stats (
healthyClusters,totalClusters,uniqueRegions,providerCount) directly frombaseClustersrather than the filteredclusters/regionGroups.
There was a problem hiding this comment.
Clean, well-scoped fix. Separating baseClusters (global/reachability scope) from clusters (with status chip and search applied) correctly ensures stats tiles reflect the full fleet rather than the filtered view. The useMemo dependency arrays are minimal and correct. LGTM ✅
|
@kubestellar-hive[bot]: changing LGTM is restricted to collaborators DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@kubestellar-hive[bot]: changing LGTM is restricted to collaborators DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@kubestellar-hive[bot]: changing LGTM is restricted to collaborators DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
There was a problem hiding this comment.
Security review ✅ — No concerns.
Pure UI logic refactor: splits clusters memo into baseClusters (global/reachability scope) and clusters (status chip + search). Stats tiles now read from baseClusters so fleet totals don't fluctuate with local filters. No API changes, no new data flows, no XSS vectors.
|
@kubestellar-hive[bot]: changing LGTM is restricted to collaborators DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
There was a problem hiding this comment.
Security review: ✅ No concerns
UI-only change refactoring the filtering pipeline in ClusterLocations. Separates base scoping from display filtering so stats stay stable. No security implications — no new external inputs, no href changes, no data fetching changes.
|
Hi @ashnaaseth2325-oss — the logic in this PR looks good! Splitting The CI failures are all caused by a stale branch — main has moved significantly since this PR was created. Please rebase onto current git fetch origin main
git rebase origin/main
# resolve any conflicts, then:
git push --force-with-leaseOnce the rebase is pushed CI will re-run. Let us know if you run into any conflicts! |
There was a problem hiding this comment.
sec-check ✅ — Pure frontend logic refactor: splits cluster filtering into baseClusters (global scope) and clusters (status/search). Stats read from baseClusters so they stay stable during local filtering. No new data flows, no DOM sinks, no security concerns.
|
@kubestellar-hive[bot]: changing LGTM is restricted to collaborators DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
🔒 Security Review: ✅ PASSNo security issues found. Clean refactor — proper array safety, no XSS vectors, no injection risks. Safe to merge. |
635da55
into
kubestellar:main
SUMMARY
This PR fixes
ClusterLocationsstats tiles so fleet-level metrics remain stable when users apply status chips or local search filters. The change separates global/reachability scoping from UI-level filtering, ensuring the stats bar always reflects the full scoped fleet while the map markers and cluster list continue to respond to active filters.Primary changes are in
web/src/components/cards/ClusterLocations.tsx, specifically the filtering pipeline and stats computation logic.FIX