1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Always refresh stores when object list is mounted (#277)

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2020-04-20 07:32:53 +03:00 committed by GitHub
parent 6bdd247a85
commit e7511a41ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -114,9 +114,7 @@ export class ItemListLayout extends React.Component<ItemListLayoutProps> {
const { store, dependentStores, isClusterScoped } = this.props;
const stores = [store, ...dependentStores];
if (!isClusterScoped) stores.push(namespaceStore);
const loadingStores = stores.filter(store => !store.isLoaded);
loadingStores.forEach(store => store.loadAll());
await when(() => loadingStores.every(store => !store.isLoading));
await Promise.all(stores.map(store => store.loadAll()));
const subscriptions = stores.map(store => store.subscribe());
await when(() => this.isUnmounting);
subscriptions.forEach(dispose => dispose()); // unsubscribe all