@@ -109,35 +109,35 @@ const ApplicationList: React.FC<ApplicationProps> = ({
109109 return sortData ( applications , sortBy , direction ) ;
110110 } , [ applications , sortBy , direction ] ) ;
111111
112- // TODO: use alternate filter since it is deprecated. See DataTableView potentially
113- const filters = getFilters ( t ) ;
114- const [ data , filteredData , onFilterChange ] = useListPageFilter ( sortedApplications , filters ) ;
115-
116- // Filter applications by project or appset before rendering rows
112+ // Filter applications by project or appset BEFORE calculating filter counts
117113 const filteredByOwner = React . useMemo (
118- ( ) => filteredData . filter ( filterApp ( project , appset ) ) ,
119- [ filteredData , project , appset ] ,
114+ ( ) => sortedApplications . filter ( filterApp ( project , appset ) ) ,
115+ [ sortedApplications , project , appset ] ,
120116 ) ;
121117
118+ // TODO: use alternate filter since it is deprecated. See DataTableView potentially
119+ const filters = getFilters ( t ) ;
120+ const [ data , filteredData , onFilterChange ] = useListPageFilter ( filteredByOwner , filters ) ;
121+
122122 // Filter by search query if present (after other filters)
123123 const filteredBySearch = React . useMemo ( ( ) => {
124- if ( ! searchQuery ) return filteredByOwner ;
124+ if ( ! searchQuery ) return filteredData ;
125125
126- return filteredByOwner . filter ( ( app ) => {
126+ return filteredData . filter ( ( app ) => {
127127 const labels = app . metadata ?. labels || { } ;
128128 // Check if any label matches the search query
129129 return Object . entries ( labels ) . some ( ( [ key , value ] ) => {
130130 const labelSelector = `${ key } =${ value } ` ;
131131 return labelSelector . includes ( searchQuery ) || key . includes ( searchQuery ) ;
132132 } ) ;
133133 } ) ;
134- } , [ filteredByOwner , searchQuery ] ) ;
134+ } , [ filteredData , searchQuery ] ) ;
135135 const rows = useApplicationRowsDV ( filteredBySearch , namespace ) ;
136136
137137 // Check if there are applications owned by this ApplicationSet initially (before search)
138138 const hasOwnedApplications = React . useMemo ( ( ) => {
139- return sortedApplications . some ( filterApp ( project , appset ) ) ;
140- } , [ sortedApplications , project , appset ] ) ;
139+ return filteredByOwner . length > 0 ;
140+ } , [ filteredByOwner ] ) ;
141141 const empty = (
142142 < Tbody >
143143 < Tr key = "loading" ouiaId = "table-tr-loading" >
0 commit comments