remove oddity of KubeObjectStore.getById(undefined) being allowed

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2022-05-05 09:38:43 -04:00
1 parent 3252dfc7f1
commit a0f22d642d
2 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -157,7 +157,7 @@ export abstract class KubeObjectStore<
return []; return [];
} }
getById(id: string | undefined): K | undefined { getById(id: string): K | undefined {
return this.items.find(item => item.getId() === id); return this.items.find(item => item.getId() === id);
} }
+2 -2
View File
@@ -109,8 +109,8 @@ export const logTabStore = asLegacyGlobalObjectForExtensionApiWithModifications(
createPodTab: asLegacyGlobalFunctionForExtensionApi(createPodLogsTabInjectable), createPodTab: asLegacyGlobalFunctionForExtensionApi(createPodLogsTabInjectable),
createWorkloadTab: asLegacyGlobalFunctionForExtensionApi(createWorkloadLogsTabInjectable), createWorkloadTab: asLegacyGlobalFunctionForExtensionApi(createWorkloadLogsTabInjectable),
renameTab: (tabId: string): void => { renameTab: (tabId: string): void => {
const tabData = logTabStore.getData(tabId); const { selectedPodId } = logTabStore.getData(tabId) ?? {};
const pod = podStore.getById(tabData?.selectedPodId); const pod = selectedPodId && podStore.getById(selectedPodId);
if (pod) { if (pod) {
renameTab(tabId, `Pod ${pod.getName()}`); renameTab(tabId, `Pod ${pod.getName()}`);