diff --git a/src/main/catalog-sources/__test__/kubeconfig-sync.test.ts b/src/main/catalog-sources/__test__/kubeconfig-sync.test.ts index f04458c3c86e..4d3820fd37f1 100644 --- a/src/main/catalog-sources/__test__/kubeconfig-sync.test.ts +++ b/src/main/catalog-sources/__test__/kubeconfig-sync.test.ts @@ -14,9 +14,8 @@ import { ClusterManager } from "../../cluster-manager"; import clusterStoreInjectable from "../../../common/cluster-store/cluster-store.injectable"; import { getDiForUnitTesting } from "../../getDiForUnitTesting"; import { createClusterInjectionToken } from "../../../common/cluster/create-cluster-injection-token"; -import directoryForKubeConfigsInjectable - from "../../../common/app-paths/directory-for-kube-configs/directory-for-kube-configs.injectable"; - +import directoryForKubeConfigsInjectable from "../../../common/app-paths/directory-for-kube-configs/directory-for-kube-configs.injectable"; +import { ClusterStore } from "../../../common/cluster-store/cluster-store"; jest.mock("electron", () => ({ app: { @@ -57,6 +56,7 @@ describe("kubeconfig-sync.source tests", () => { afterEach(() => { mockFs.restore(); ClusterManager.resetInstance(); + ClusterStore.resetInstance(); }); describe("configsToModels", () => { diff --git a/src/main/context-handler/create-context-handler.injectable.ts b/src/main/context-handler/create-context-handler.injectable.ts index a40e1e192398..86867ccdfb84 100644 --- a/src/main/context-handler/create-context-handler.injectable.ts +++ b/src/main/context-handler/create-context-handler.injectable.ts @@ -8,19 +8,20 @@ import type { Cluster } from "../../common/cluster/cluster"; import { ContextHandler } from "./context-handler"; import createKubeAuthProxyInjectable from "../kube-auth-proxy/create-kube-auth-proxy.injectable"; import { getKubeAuthProxyCertificate } from "../kube-auth-proxy/get-kube-auth-proxy-certificate"; +import URLParse from "url-parse"; const createContextHandlerInjectable = getInjectable({ id: "create-context-handler", instantiate: (di) => { return (cluster: Cluster) => { - const clusterUrl = new URL(cluster.apiUrl); + const clusterUrl = new URLParse(cluster.apiUrl); const dependencies = { createKubeAuthProxy: di.inject(createKubeAuthProxyInjectable), authProxyCa: getKubeAuthProxyCertificate(clusterUrl.hostname, selfsigned.generate).cert, }; - + return new ContextHandler(dependencies, cluster); }; }, diff --git a/src/renderer/components/dock/logs/view.tsx b/src/renderer/components/dock/logs/view.tsx index 0f9069daface..6385b1ca9c2b 100644 --- a/src/renderer/components/dock/logs/view.tsx +++ b/src/renderer/components/dock/logs/view.tsx @@ -57,8 +57,9 @@ const NonInjectedLogsDockTab = observer(({ className, tab, model, subscribeStore setTimeout(() => { const overlay = document.querySelector(".PodLogs .list span.active"); - if (!overlay) return; - overlay.scrollIntoViewIfNeeded(); + if (typeof overlay?.scrollIntoViewIfNeeded === "function") { + overlay.scrollIntoViewIfNeeded(); + } }, 100); }; diff --git a/src/renderer/components/tabs/tabs.tsx b/src/renderer/components/tabs/tabs.tsx index 39138863655f..58e94f33dc20 100644 --- a/src/renderer/components/tabs/tabs.tsx +++ b/src/renderer/components/tabs/tabs.tsx @@ -81,7 +81,9 @@ export class Tab extends React.PureComponent { } scrollIntoView() { - this.ref.current?.scrollIntoViewIfNeeded(); + if (typeof this.ref.current?.scrollIntoViewIfNeeded === "function") { + this.ref.current.scrollIntoViewIfNeeded(); + } } @boundMethod diff --git a/types/dom.d.ts b/types/dom.d.ts index eb6bc83dbe99..0e3e1bcb43b9 100644 --- a/types/dom.d.ts +++ b/types/dom.d.ts @@ -6,7 +6,7 @@ export {}; declare global { interface Element { - scrollIntoViewIfNeeded(opt_center?: boolean): void; + scrollIntoViewIfNeeded?(opt_center?: boolean): void; } interface Window {