diff --git a/packages/renderer/src/lib/deployments/DeploymentsList.spec.ts b/packages/renderer/src/lib/deployments/DeploymentsList.spec.ts index 69a44977802ea..7e124ff79ef8a 100644 --- a/packages/renderer/src/lib/deployments/DeploymentsList.spec.ts +++ b/packages/renderer/src/lib/deployments/DeploymentsList.spec.ts @@ -40,6 +40,7 @@ beforeEach(() => { vi.clearAllMocks(); (window as any).kubernetesGetContextsGeneralState = () => Promise.resolve(new Map()); (window as any).kubernetesGetCurrentContextGeneralState = () => Promise.resolve({}); + (window as any).window.kubernetesUnregisterGetCurrentContextResources = () => Promise.resolve(undefined); }); async function waitRender(customProperties: object): Promise { diff --git a/packages/renderer/src/stores/kubernetes-contexts-state.ts b/packages/renderer/src/stores/kubernetes-contexts-state.ts index 49e3203f05647..abcd561816e75 100644 --- a/packages/renderer/src/stores/kubernetes-contexts-state.ts +++ b/packages/renderer/src/stores/kubernetes-contexts-state.ts @@ -48,6 +48,9 @@ export const kubernetesCurrentContextDeployments = readable( window.events?.receive('kubernetes-current-context-deployments-update', (value: unknown) => { set(value as KubernetesObject[]); }); + return () => { + window.kubernetesUnregisterGetCurrentContextResources('deployments'); + }; }); export const deploymentSearchPattern = writable('');