Skip to content

Commit d4b0b52

Browse files
fix(dashboard): gate options query on tenant namespace
Address review feedback from gemini-code-assist on DynamicOptionsWidget.tsx: gate the useK8sList options query with enabled: !!tenantNamespace so it does not fire a cluster-wide request to core.cozystack.io options (403 for non-admin tenants) while the tenant namespace is still resolving. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent 2c4b936 commit d4b0b52

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

‎packages/system/dashboard/images/console/apps/console/src/components/DynamicOptionsWidget.tsx‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,15 @@ export function DynamicOptionsWidget(props: WidgetProps) {
4040
"x-cozystack-options"
4141
]?.source
4242

43-
const { data: optionList, isLoading } = useK8sList<OptionObject>({
44-
apiGroup: "core.cozystack.io",
45-
apiVersion: "v1alpha1",
46-
plural: "options",
47-
namespace: tenantNamespace ?? undefined,
48-
})
43+
const { data: optionList, isLoading } = useK8sList<OptionObject>(
44+
{
45+
apiGroup: "core.cozystack.io",
46+
apiVersion: "v1alpha1",
47+
plural: "options",
48+
namespace: tenantNamespace ?? undefined,
49+
},
50+
{ enabled: !!tenantNamespace },
51+
)
4952

5053
const items: OptionItem[] =
5154
optionList?.items?.find((o) => o.metadata.name === source)?.spec?.items ?? []

0 commit comments

Comments
 (0)