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

remove oddity of KubeObjectStore.getById(undefined) being allowed

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

View File

@ -157,7 +157,7 @@ export abstract class KubeObjectStore<
return [];
}
getById(id: string | undefined): K | undefined {
getById(id: string): K | undefined {
return this.items.find(item => item.getId() === id);
}

View File

@ -109,8 +109,8 @@ export const logTabStore = asLegacyGlobalObjectForExtensionApiWithModifications(
createPodTab: asLegacyGlobalFunctionForExtensionApi(createPodLogsTabInjectable),
createWorkloadTab: asLegacyGlobalFunctionForExtensionApi(createWorkloadLogsTabInjectable),
renameTab: (tabId: string): void => {
const tabData = logTabStore.getData(tabId);
const pod = podStore.getById(tabData?.selectedPodId);
const { selectedPodId } = logTabStore.getData(tabId) ?? {};
const pod = selectedPodId && podStore.getById(selectedPodId);
if (pod) {
renameTab(tabId, `Pod ${pod.getName()}`);