Skip to content

Commit 4afe65d

Browse files
committed
fix: update filter handling in K8ResourceComponent to preserve existing search parameters
1 parent e726777 commit 4afe65d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/components/v2/appDetails/k8Resource/K8Resource.component.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,16 @@ export const K8ResourceComponent = ({
104104
}
105105

106106
const handleFilterClick = (selectedFilter: string) => {
107-
const searchParams = new URLSearchParams([['filterType', selectedFilter]])
107+
const searchParams = new URLSearchParams(location.search)
108+
searchParams.set('filterType', selectedFilter)
109+
108110
IndexStore.updateFilterType(selectedFilter.toUpperCase())
109111
if (selectedFilter === ALL_RESOURCE_KIND_FILTER) {
110-
history.push({ search: '' })
112+
searchParams.delete('filterType')
113+
history.push({ search: `${searchParams}` })
111114
return
112115
}
116+
113117
// current selected node exist in new selected filter or not
114118
const nextFilterNodes = nodes.filter((node) => doesNodeSatisfiesFilter(node, selectedFilter))
115119
const selectedNodeExists = nextFilterNodes.some((node) => node.kind.toLowerCase() === currentNode)

0 commit comments

Comments
 (0)