From 371597570115a101974eb173da98d124deeb7991 Mon Sep 17 00:00:00 2001 From: Nick Mitchell Date: Tue, 29 Jun 2021 18:49:24 -0400 Subject: [PATCH] fix(plugins/plugin-kubectl): CurrentContext does not respond to new contexts part of #7741 --- plugins/plugin-kubectl/components/src/CurrentContext.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/plugin-kubectl/components/src/CurrentContext.tsx b/plugins/plugin-kubectl/components/src/CurrentContext.tsx index c53d5bca6d6..e47a09d9d0a 100644 --- a/plugins/plugin-kubectl/components/src/CurrentContext.tsx +++ b/plugins/plugin-kubectl/components/src/CurrentContext.tsx @@ -121,7 +121,13 @@ export default class CurrentContext extends React.PureComponent { private async getCurrentContextFromChange() { const tab = getCurrentTab() const defaultCurrentContext = await getCurrentDefaultContextName(tab) + + const allContexts = this.state.allContexts.find(_ => _.metadata.name === defaultCurrentContext) + ? this.state.allContexts + : await getAllContexts(tab) + this.setState({ + allContexts, currentContext: this.renderName(defaultCurrentContext) }) }