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

resolve review comments

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2021-02-11 11:51:55 -05:00
parent aed51c1ab4
commit 80352f5b3b
5 changed files with 9 additions and 13 deletions

View File

@ -0,0 +1 @@
export type Disposer = () => void;

View File

@ -19,3 +19,4 @@ export * from "./downloadFile";
export * from "./escapeRegExp";
export * from "./tar";
export * from "./delay";
export * from "./common-types";

View File

@ -78,11 +78,11 @@ export class KubeWatchApi {
}
};
let subscribeP: Promise<void>;
let subscribing: Promise<void> = Promise.resolve();
if (preloading) {
if (waitUntilLoaded) {
subscribeP = preloading.loading
subscribing = preloading.loading
.then(() => subscribe(ac.signal))
.catch(error => {
this.log({
@ -91,7 +91,7 @@ export class KubeWatchApi {
});
});
} else {
subscribeP = subscribe(ac.signal);
subscribing = subscribe(ac.signal);
}
// reload stores only for context namespaces change
@ -100,14 +100,14 @@ export class KubeWatchApi {
preloading.cancelLoading();
}
ac.abort();
subscribeP.then(() => {
subscribing.then(() => {
unsubscribeList.forEach(unsubscribe => unsubscribe());
unsubscribeList.length = 0;
ac = new AbortController();
preloading = load(namespaces);
preloading.loading
.then(() => subscribeP = subscribe(ac.signal));
.then(() => subscribing = subscribe(ac.signal));
});
}, {
equals: comparer.shallow,
@ -124,7 +124,7 @@ export class KubeWatchApi {
preloading.cancelLoading();
}
ac.abort();
subscribeP.then(() => {
subscribing.then(() => {
unsubscribeList.forEach(unsubscribe => unsubscribe());
unsubscribeList.length = 0;
});

View File

@ -65,11 +65,7 @@ export class NamespaceStore extends KubeObjectStore<Namespace> {
}
private autoLoadAllowedNamespaces(): IReactionDisposer {
return reaction(() => this.allowedNamespaces, namespaces => {
console.log("autoLoadAllowedNamespaces", namespaces);
return this.loadAll({ namespaces });
}, {
return reaction(() => this.allowedNamespaces, namespaces => this.loadAll({ namespaces }), {
fireImmediately: true,
equals: comparer.shallow,
});

View File

@ -2,8 +2,6 @@
export const isElectron = !!navigator.userAgent.match(/Electron/);
export type Disposer = () => void;
export * from "../../common/utils";
export * from "./cssVar";