Skip to content

Commit 08ca84f

Browse files
fix: remove filtering on props
1 parent 844dc64 commit 08ca84f

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/components/ClusterNodes/ClusterSelectionList.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,15 @@ export default function ClusterSelectionList({
3636
const [searchApplied, setSearchApplied] = useState(false)
3737

3838
useEffect(() => {
39+
let filteredClusterOptions = clusterOptions
3940
if (window._env_.HIDE_DEFAULT_CLUSTER) {
40-
clusterOptions = clusterOptions.filter((item) => item.id !== DEFAULT_CLUSTER_ID)
41+
filteredClusterOptions = clusterOptions.filter((item) => item.id !== DEFAULT_CLUSTER_ID)
4142
}
4243
setClusterList([])
4344
setFilteredClusterList([])
4445
setLastDataSync(!lastDataSync)
45-
setClusterList(clusterOptions)
46-
setFilteredClusterList(clusterOptions)
46+
setClusterList(filteredClusterOptions)
47+
setFilteredClusterList(filteredClusterOptions)
4748
setMinLoader(false)
4849
}, [clusterOptions])
4950

src/components/ResourceBrowser/ResourceList/ClusterSelector.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@ interface ClusterSelectorType {
1919
}
2020

2121
export default function ClusterSelector({ onChange, clusterList, clusterId }: ClusterSelectorType) {
22+
let filteredClusterList = clusterList
2223
if (window._env_.HIDE_DEFAULT_CLUSTER) {
23-
clusterList = clusterList.filter((item) => Number(item.value) !== DEFAULT_CLUSTER_ID)
24+
filteredClusterList = clusterList.filter((item) => Number(item.value) !== DEFAULT_CLUSTER_ID)
2425
}
25-
const defaultOption = clusterList.find((item) => item.value == clusterId)
26+
const defaultOption = filteredClusterList.find((item) => item.value == clusterId)
2627

2728
return (
2829
<ReactSelect
2930
classNamePrefix="cluster-select-header"
30-
options={clusterList}
31+
options={filteredClusterList}
3132
onChange={onChange}
3233
components={{
3334
IndicatorSeparator: null,

0 commit comments

Comments
 (0)