chore / small fixes

Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman committed 2021-01-12 13:44:55 +02:00
1 parent 62e0f575c7
commit 4a8079debc
3 files changed
+45 -38

No files matched your search

@@ -112,11 +112,13 @@ export class ItemListLayout extends React.Component<ItemListLayoutProps> {
}
async componentDidMount() {
disposeOnUnmount(this, [
namespaceStore.onContextChange(() => this.loadStores(), {
fireImmediately: true,
})
]);
if (!this.props.isClusterScoped) {
disposeOnUnmount(this, [
namespaceStore.onContextChange(() => this.loadStores(), {
fireImmediately: true,
})
]);
}
}
async componentWillUnmount() {
@@ -124,7 +126,7 @@ export class ItemListLayout extends React.Component<ItemListLayoutProps> {
this.unsubscribeStores();
}
async loadStores() {
@computed get stores() {
const { store, dependentStores, isClusterScoped } = this.props;
const stores = new Set([store, ...dependentStores]);
@@ -132,11 +134,14 @@ export class ItemListLayout extends React.Component<ItemListLayoutProps> {
stores.add(namespaceStore);
}
// reset
this.unsubscribeStores();
return stores;
}
async loadStores() {
this.unsubscribeStores(); // reset first
// load
for (const store of stores) {
for (const store of this.stores) {
if (this.isUnmounting) {
this.unsubscribeStores();
break;