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:
parent
aed51c1ab4
commit
80352f5b3b
1
src/common/utils/common-types.ts
Normal file
1
src/common/utils/common-types.ts
Normal file
@ -0,0 +1 @@
|
||||
export type Disposer = () => void;
|
||||
@ -19,3 +19,4 @@ export * from "./downloadFile";
|
||||
export * from "./escapeRegExp";
|
||||
export * from "./tar";
|
||||
export * from "./delay";
|
||||
export * from "./common-types";
|
||||
|
||||
@ -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;
|
||||
});
|
||||
|
||||
@ -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,
|
||||
});
|
||||
|
||||
@ -2,8 +2,6 @@
|
||||
|
||||
export const isElectron = !!navigator.userAgent.match(/Electron/);
|
||||
|
||||
export type Disposer = () => void;
|
||||
|
||||
export * from "../../common/utils";
|
||||
|
||||
export * from "./cssVar";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user