Fix secondary menu not updating reactively when CRDs are created#17781
Fix secondary menu not updating reactively when CRDs are created#17781cnotv wants to merge 1 commit into
Conversation
0097a7d to
0dd1b59
Compare
0dd1b59 to
94077c3
Compare
| * it means a CRD was added or removed. Re-build the nav so the new group | ||
| * shows up under "More Resources" without requiring a page refresh. | ||
| */ | ||
| countTypes(a, b) { |
There was a problem hiding this comment.
we might need to reconsider this.
re-rendering the side nav on count change was something we used to do but hit large performance issues given counts change a lot, and in some scenarios there's 1000s of schemas (i.e. crossplane world).
in theory all new schema's should be picked up via the computed property allSchemasIds which has a watch that calls queueUpdate?
There was a problem hiding this comment.
I have no idea about this logic, as you are the master.
I made this bug go away, but if you have tips, I welcome them and shove them to the AI :)
There was a problem hiding this comment.
Is the bug still reproducible when this part is removed? If not then it should be enough just to remove it. If so though it might be worth debugging the allSchemasIds part and see it can be fixed there
There was a problem hiding this comment.
That's the whole point of the fix, and it does not work without it.
If you want to have time to experiment, I leave it to you to play around and keep the PR open till you feel is ok.
There was a problem hiding this comment.
@cnotv @richard-cox I double-checked the allSchemasIds var and getGroups.
The new schemas are correctly added to allSchemasIds but the object count is still zero. I created a new CRD (test.com.item) and a CR (name: demo-item, type: test.com.item from the recording)
// DEBUG: Check if test.com.item is in the types and what's its count
if (Object.keys(types).includes('test.com.item')) {
const testType = types['test.com.item'];
const inStore = this.$store.getters.currentStore(testType.name);
const count = this.$store.getters[`${ inStore }/count`](testType);
console.log('[SideNav.getProductsGroups] ✅ test.com.item FOUND in', mode, 'mode! Count:', count);
} else if (mode === 'used') {
console.log('[SideNav.getProductsGroups] ❌ test.com.item NOT found in USED mode');
}
const more = this.$store.getters['type-map/getTree'](productId, mode, types, clusterId, namespaceMode, currentType);
console.log('More', more);
apiVersion: test.com/v1
kind: Item
metadata:
name: demo-item
EOF
- The new test.com.item is missing from
children - After a page refresh, the count is finally
1
I think the problem is the store not receiving the count update for the new schema -> the getTree doesn't return the new entry.
The fact that the countTypes watcher works, means that there is a timing issue? Maybe when getGroups() is called the count is not updated yet...
Summary
Fixes #16664
Occurred changes and/or fixed issues
shell/components/__tests__/SideNav.test.tsshell/plugins/steve/subscribe.jsTechnical notes summary
Areas or cases that should be tested
Areas which could experience regressions
Screenshot/Video
Kapture.2026-05-22.at.10.07.32.mp4
Checklist
Admin,Standard UserandUser Base