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) }) }