Fix findLabelSelector and matchingLabelSelector#16707
Fix findLabelSelector and matchingLabelSelector#16707richard-cox merged 3 commits intorancher:masterfrom
Conversation
- findLabelSelector - Ensure we correctly set the state of the cache given the values in the collection - e.g. if we've cleared the cache for a specific selector mark other selectors as missing - matchingLabelSelector - if we've fetched a page assume it's a trimmed down result set ready for further trimming by selector
ac9d706 to
34933d2
Compare
| } | ||
|
|
||
| cache.haveSelector[selector] = true; | ||
| cache.haveSelector = { [selector]: true }; |
There was a problem hiding this comment.
at some point we should remove the map part and just use cache.haveSelector=selector i chickened out though given this is bug complete week.
i can create a tech debt issue if requested
| // Filter first by namespace if one is provided, since this is efficient | ||
| if (namespace && typeof namespace === 'string') { | ||
| matching = type === POD ? getters['podsByNamespace'](namespace) : matching.filter((obj) => obj.namespace === namespace); | ||
| matching = type === POD && !selector ? getters['podsByNamespace'](namespace) : matching.filter((obj) => obj.namespace === namespace); |
There was a problem hiding this comment.
this is a secondary fix. matchingLabelSelector calls matching. if there's a selector we shouldn't return all pods in a namespace but go on to apply it
| hash.pods = this.value.fetchPods(); | ||
| } | ||
|
|
||
| if (this.serviceSchema) { |
There was a problem hiding this comment.
Pull request overview
Fixes caching inconsistencies when fetching resources by label selector (notably pods for Services/Workloads) across both VAI pagination-enabled and disabled modes, and restores missing service fetching on workload detail pages.
Changes:
- Reset selector-cache bookkeeping in
loadSelectorto avoid accumulating stale selectors. - Ensure
matchingLabelSelectorapplies the label selector when the store currently represents a paginated result set. - Re-add fetching of Services in the workload detail view to populate related-services UI.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
shell/plugins/dashboard-store/mutations.js |
Adjust selector-cache tracking to avoid stale selector records. |
shell/plugins/dashboard-store/getters.js |
Apply label selector filtering when cache contains a page/all rather than a selector-only result set. |
shell/plugins/dashboard-store/actions.js |
Fix typo in comment in findLabelSelector option handling. |
shell/detail/workload/index.vue |
Fetch namespaced Services during workload detail load to repopulate related services list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Fixes #15529
Fixes #16732
Occurred changes and/or fixed issues
Technical notes summary
Also fixed an issue where the selector was ignored when fetching
matchingpodsAreas or cases that should be tested
With vai off and on
Areas which could experience regressions
With vai off and on
Overviewpage should show card with link to longhorn service --> click --> should load long horn ui (page just needs to load, it can show errors)longhorn-uiDetail page --> services list should be populatedChecklist
Admin,Standard UserandUser Base