From de2c6840967705dbed2b8357c53dfafa6c27d176 Mon Sep 17 00:00:00 2001 From: chan Date: Mon, 20 Apr 2026 09:32:32 +0900 Subject: [PATCH] fix: follow rules of hooks in TenantSchemaPage --- .../src/features/tenants/routes/TenantSchemaPage.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/adminfront/src/features/tenants/routes/TenantSchemaPage.tsx b/adminfront/src/features/tenants/routes/TenantSchemaPage.tsx index 113d8573..fc185f02 100644 --- a/adminfront/src/features/tenants/routes/TenantSchemaPage.tsx +++ b/adminfront/src/features/tenants/routes/TenantSchemaPage.tsx @@ -58,7 +58,10 @@ export function TenantSchemaPage() { const tenantQuery = useQuery({ queryKey: ["tenant", tenantId], - queryFn: () => fetchTenant(tenantId!), + queryFn: () => { + if (!tenantId) throw new Error("Tenant ID is required"); + return fetchTenant(tenantId); + }, enabled: !!tenantId && canAccess, }); @@ -94,6 +97,8 @@ export function TenantSchemaPage() { const updateMutation = useMutation({ mutationFn: (newFields: SchemaField[]) => { + if (!tenantId) throw new Error("Tenant ID is required"); + // Remove legacy loginIdField, keep isLoginId natively in userSchema const newConfig = { ...tenantQuery.data?.config }; newConfig.loginIdField = undefined;