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

fix build

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-03-21 11:13:32 -04:00
parent 5e9cc18065
commit 4f7dcc32b8
3 changed files with 17 additions and 9 deletions

View File

@ -169,11 +169,9 @@ export class UserStore extends BaseStore<UserStoreModel> /* implements UserStore
const curVal = this[key]; const curVal = this[key];
const newVal = fromStore((preferences)?.[key] as never) as never; const newVal = fromStore((preferences)?.[key] as never) as never;
if ( if (isObservableArray(curVal)) {
isObservableArray(curVal) curVal.replace(newVal);
|| isObservableSet(curVal) } else if (isObservableSet(curVal) || isObservableMap(curVal)) {
|| isObservableMap(curVal)
) {
curVal.replace(newVal); curVal.replace(newVal);
} else { } else {
this[key] = newVal; this[key] = newVal;

View File

@ -42,3 +42,10 @@ export function* zip<T, N extends number>(...sources: Tuple<T[], N>): Iterator<T
export function filled<T, L extends number>(length: L, value: T): Tuple<T, L> { export function filled<T, L extends number>(length: L, value: T): Tuple<T, L> {
return array.filled(length, value) as Tuple<T, L>; return array.filled(length, value) as Tuple<T, L>;
} }
/**
* A function for converting an explicit array to a tuple but without the `readonly` typing
*/
export function from<T extends any[]>(...args: T): [...T] {
return args;
}

View File

@ -11,7 +11,7 @@ import { Notice } from "../+extensions/notice";
import { KubeconfigSyncEntry, KubeconfigSyncValue, UserStore } from "../../../common/user-store"; import { KubeconfigSyncEntry, KubeconfigSyncValue, UserStore } from "../../../common/user-store";
import { isWindows } from "../../../common/vars"; import { isWindows } from "../../../common/vars";
import logger from "../../../main/logger"; import logger from "../../../main/logger";
import { iter } from "../../utils"; import { iter, tuple } from "../../utils";
import { SubTitle } from "../layout/sub-title"; import { SubTitle } from "../layout/sub-title";
import { PathPicker } from "../path-picker/path-picker"; import { PathPicker } from "../path-picker/path-picker";
import { Spinner } from "../spinner"; import { Spinner } from "../spinner";
@ -79,9 +79,12 @@ export class KubeconfigSyncs extends React.Component {
this.loaded = true; this.loaded = true;
disposeOnUnmount(this, [ disposeOnUnmount(this, [
reaction(() => Array.from(this.syncs.entries(), ([filePath, { data }]) => [filePath, data]), syncs => { reaction(
UserStore.getInstance().syncKubeconfigEntries.replace(syncs); () => Array.from(this.syncs.entries(), ([filePath, { data }]) => tuple.from(filePath, data)),
}), syncs => {
UserStore.getInstance().syncKubeconfigEntries.replace(syncs);
},
),
]); ]);
} }