Skip to content

Commit 3a98bc4

Browse files
committed
Ensure PaginatedResourceTable blocks first render on fetchSecondaryResources
- a list may need secondary resources - these can either be to support the whole list (fetchSecondaryResources), or an individual page (fetchPageSecondaryResources) - for fetchSecondaryResources, often used when SSP is disabled, it was trying to block loading of the list on the primary resource and secondary resource fetch - however as soon as the primary resource was fetched, before the secondary resources compelted, the list would render the page - if the page depends on secondary resources for sorting/filtering then they would be missed - fix - instead of fetching both primary at secondary in parallel fetch in sequence - this ensure the initial sort/filter is correct
1 parent b9a6614 commit 3a98bc4

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

shell/components/PaginatedResourceTable.vue

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,11 @@ export default defineComponent({
116116
},
117117
118118
async fetch() {
119-
const promises = [
120-
this.$fetchType(this.resource, [], this.overrideInStore || this.inStore),
121-
];
122-
123119
if (this.fetchSecondaryResources) {
124-
promises.push(this.fetchSecondaryResources({ canPaginate: this.canPaginate }));
120+
await this.fetchSecondaryResources({ canPaginate: this.canPaginate });
125121
}
126122
127-
await Promise.all(promises);
123+
await this.$fetchType(this.resource, [], this.overrideInStore || this.inStore);
128124
},
129125
130126
computed: {

shell/pages/home.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,11 @@ export default defineComponent({
302302
return Promise.resolve({});
303303
}
304304
305+
const promises = [];
306+
305307
if ( this.canViewMgmtClusters ) {
306-
this.$store.dispatch('management/findAll', { type: MANAGEMENT.CLUSTER });
308+
// This is the only one we need to block on (needed for the initial sort on mgmt name)
309+
promises.push(this.$store.dispatch('management/findAll', { type: MANAGEMENT.CLUSTER }));
307310
}
308311
309312
if ( this.canViewMachine ) {
@@ -323,7 +326,7 @@ export default defineComponent({
323326
this.$store.dispatch('management/findAll', { type: MANAGEMENT.NODE_TEMPLATE });
324327
}
325328
326-
return Promise.resolve({});
329+
return Promise.all(promises);
327330
},
328331
329332
async fetchPageSecondaryResources({

0 commit comments

Comments
 (0)