Skip to content

Commit

Permalink
Fix dupe inStore
Browse files Browse the repository at this point in the history
- remove from resource list, put in resource-fetch (used also by pag res table)
  • Loading branch information
richard-cox committed Dec 3, 2024
1 parent f1858b6 commit 96b6b9a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 0 additions & 2 deletions shell/components/ResourceList/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,9 @@ export default {
const showMasthead = getters[`type-map/optionsFor`](resource).showListMasthead;
return {
inStore,
schema,
hasListComponent,
showMasthead: showMasthead === undefined ? true : showMasthead,
resource,
extensionType: ExtensionPoint.PANEL,
extensionLocation: PanelLocation.RESOURCE_LIST,
loadResources: [resource], // List of resources that will be loaded, this could be many (`Workloads`)
Expand Down
4 changes: 0 additions & 4 deletions shell/mixins/resource-fetch-api-pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,6 @@ export default {
showDynamicRancherNamespaces() {
return this.$store.getters['prefs/get'](ALL_NAMESPACES);
},

inStore() {
return this.$store.getters['currentStore'](this.resource) || this.currentProduct?.inStore;
}
},

watch: {
Expand Down
11 changes: 10 additions & 1 deletion shell/mixins/resource-fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,18 @@ export default {
perfConfig = DEFAULT_PERF_SETTING;
}

// Normally owner components supply `resource` and `inStore` as part of their data, however these are needed here before parent data runs
// So set up both here
const params = { ...this.$route.params };
const resource = params.resource || this.schema.id; // Resource can either be on a page showing single list, or a page of a resource showing a list of another resource
const inStore = this.$store.getters['currentStore'](resource);

return {
inStore,
perfConfig,
init: false,
multipleResources: [],
loadResources: [this.resource],
loadResources: [resource],
// manual refresh vars
hasManualRefresh: false,
watch: true,
Expand Down Expand Up @@ -72,6 +79,7 @@ export default {

computed: {
...mapGetters({ refreshFlag: 'resource-fetch/refreshFlag' }),

rows() {
const currResource = this.fetchedResourceType.find((item) => item.type === this.resource);

Expand All @@ -92,6 +100,7 @@ export default {

return [];
},

loading() {
if (this.canPaginate) {
return this.paginating;
Expand Down

0 comments on commit 96b6b9a

Please sign in to comment.