Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit af66aa4

Browse files
myan9starpit
authored andcommitted
fix(plugins/plugin-kubectl): get-namespace table sometimes doens't show the correct selected namespace
Fixes #4812
1 parent 1976134 commit af66aa4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

plugins/plugin-kubectl/src/controller/kubectl/get-namespaces.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ async function asRadioTable(args: Arguments<KubeOptions>, { header, body }: Tabl
189189
const rowIdxForDefaultNS = body.findIndex(_ => _.name === 'default')
190190
if (rowIdxForDefaultNS !== 0 && rowIdxForDefaultNS !== defaultSelectedIdx && body.length > 2) {
191191
const defaultRow = radio.body[rowIdxForDefaultNS]
192-
radio.body.splice(rowIdxForDefaultNS, 1)
193-
radio.body.splice(1, 0, defaultRow)
192+
radio.body.splice(rowIdxForDefaultNS, 1) // delete the default row from body
193+
radio.body.splice(0, 0, defaultRow) // insert the default row at the top
194194

195195
if (defaultSelectedIdx < rowIdxForDefaultNS) {
196196
radio.defaultSelectedIdx += 1

0 commit comments

Comments
 (0)