Skip to content

Commit a5eb583

Browse files
committed
chore: selectedClusterName value reset on close
1 parent 8d5e03e commit a5eb583

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/components/ClusterNodes/ClusterList/ClusterSelectionBody.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const ClusterSelectionBody: React.FC<ClusterSelectionBodyTypes> = ({
5757
const parentRef = useRef<HTMLDivElement>(null)
5858

5959
const [lastSyncTime, setLastSyncTime] = useState<Dayjs>(dayjs())
60-
const [showKubeConfigModal, setKubeConfigModal] = useState(false)
60+
const [showKubeConfigModal, setShowKubeConfigModal] = useState(false)
6161
const [selectedClusterName, setSelectedClusterName] = useState('')
6262

6363
const { clearFilters } = useUrlFilters<ClusterMapListSortableKeys, { clusterFilter: ClusterFiltersType }>({
@@ -94,11 +94,12 @@ const ClusterSelectionBody: React.FC<ClusterSelectionBodyTypes> = ({
9494
}
9595

9696
const onChangeShowKubeConfigModal = () => {
97-
setKubeConfigModal(true)
97+
setShowKubeConfigModal(true)
9898
}
9999

100100
const onChangeCloseKubeConfigModal = () => {
101-
setKubeConfigModal(false)
101+
setShowKubeConfigModal(false)
102+
setSelectedClusterName('')
102103
}
103104

104105
const renderClusterList = () => (

src/components/ClusterNodes/utils.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,5 @@ export const getSortedClusterList = (
8787
}
8888

8989
export const parseSearchParams = (searchParams: URLSearchParams) => ({
90-
clusterFilter: (searchParams.get('clusterFilter') as ClusterFiltersType) || ClusterFiltersType.ALL_CLUSTERS,
90+
clusterFilter: (searchParams.get('clusterFilter') as ClusterFiltersType) ?? ClusterFiltersType.ALL_CLUSTERS,
9191
})

0 commit comments

Comments
 (0)