File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,15 @@ const InfrastructureMonitors = () => {
9999 const { summary, count } = monitorsWithChecksData ?? { } ;
100100 const isLoading = monitorsWithChecksLoading ;
101101
102+ // Check if any filters are active
103+ const hasActiveFilters = Boolean ( selectedStatus || selectedState || search ) ;
104+
105+ // Show empty state only when there are truly no monitors (not just filtered out)
106+ const effectiveTotalCount =
107+ hasActiveFilters && ( summary ?. totalMonitors ?? 0 ) === 0
108+ ? 1
109+ : ( summary ?. totalMonitors ?? 0 ) ;
110+
102111 // Delete hook
103112 const { deleteFn, loading : isDeleting } = useDelete ( ) ;
104113
@@ -117,7 +126,7 @@ const InfrastructureMonitors = () => {
117126 < MonitorBasePageWithStates
118127 loading = { isLoading }
119128 error = { monitorsWithChecksError }
120- totalCount = { summary ?. totalMonitors ?? 0 }
129+ totalCount = { effectiveTotalCount }
121130 page = "infrastructure"
122131 actionLink = "/infrastructure/create"
123132 >
Original file line number Diff line number Diff line change @@ -122,11 +122,23 @@ const UptimeMonitorsPage = () => {
122122
123123 const isLoading = monitorsWithChecksLoading ;
124124
125+ // Check if any filters are active
126+ const hasActiveFilters = Boolean (
127+ selectedTypes . length > 0 || selectedStatus || selectedState || search
128+ ) ;
129+
130+ // Show empty state only when there are truly no monitors (not just filtered out)
131+ // If filters are active and count is 0, pass 1 to prevent empty state fallback
132+ const effectiveTotalCount =
133+ hasActiveFilters && ( summary ?. totalMonitors ?? 0 ) === 0
134+ ? 1
135+ : ( summary ?. totalMonitors ?? 0 ) ;
136+
125137 return (
126138 < MonitorBasePageWithStates
127139 loading = { isLoading }
128140 error = { monitorsWithChecksError }
129- totalCount = { summary ?. totalMonitors ?? 0 }
141+ totalCount = { effectiveTotalCount }
130142 page = "uptime"
131143 actionLink = "/uptime/create"
132144 >
You can’t perform that action at this time.
0 commit comments