Skip to content
This repository was archived by the owner on Jun 26, 2026. It is now read-only.

Commit a6c46ed

Browse files
author
ohotnikov.ivan
committed
fix(ui): drop watch for TenantSecrets to honor labelSelector
The TenantSecrets API List() correctly applies labelSelector, but Watch() ignores it and streams every tenant Secret in the namespace (cozystack/cozystack#2527). The previous client-side filter masked the extra events but still pulled them over the wire and pollutes React Query cache. Switch the SecretsTab to List-only for TenantSecrets by disabling watch in that branch — same approach as the upstream openapi-ui dashboard. For regular Secrets (non-tenant namespaces) watch is preserved. Replaces the prior client-side filtering workaround. Signed-off-by: ohotnikov.ivan <[email protected]>
1 parent 8f71d44 commit a6c46ed

1 file changed

Lines changed: 7 additions & 16 deletions

File tree

‎apps/console/src/routes/detail/SecretsTab.tsx‎

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -200,24 +200,15 @@ export function SecretsTab({
200200

201201
const { data, isLoading } = useK8sList<K8sResource & SecretLike>(
202202
{ ...apiRef, namespace: ns },
203-
// WORKAROUND: TenantSecrets API ignores labelSelector (issue #2527)
204-
// Pass labelSelector anyway for regular Secrets, filter client-side for TenantSecrets
205-
{ labelSelector: isInTenantNamespace ? undefined : labelSelector },
203+
{
204+
labelSelector,
205+
// TenantSecrets Watch ignores labelSelector (cozystack#2527), so disable
206+
// live updates and rely on List which honors the selector correctly.
207+
watch: !isInTenantNamespace,
208+
},
206209
)
207210

208-
// Client-side filtering for TenantSecrets (workaround for API bug)
209-
const items = isInTenantNamespace && labelSelector
210-
? (data?.items ?? []).filter((item) => {
211-
const labels = item.metadata.labels ?? {}
212-
// Parse labelSelector (e.g., "key1=val1,key2=val2")
213-
const required = labelSelector.split(',').map(pair => {
214-
const [key, value] = pair.split('=')
215-
return { key: key.trim(), value: value.trim() }
216-
})
217-
// Check all required labels match
218-
return required.every(({ key, value }) => labels[key] === value)
219-
})
220-
: (data?.items ?? [])
211+
const items = data?.items ?? []
221212
return (
222213
<div className="p-6">
223214
<Section title="Secrets" bodyClassName="p-0">

0 commit comments

Comments
 (0)