From d52f25142d23a0c9d6366a0f5abc4b0ac5050a15 Mon Sep 17 00:00:00 2001 From: Darcy Ye Date: Tue, 22 Oct 2024 11:01:39 +0800 Subject: [PATCH] fix(console): fix inf loop for updating tenant context (#6704) --- .../TenantSettings/Subscription/index.tsx | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/packages/console/src/pages/TenantSettings/Subscription/index.tsx b/packages/console/src/pages/TenantSettings/Subscription/index.tsx index 4c37bc2d2..07232ee82 100644 --- a/packages/console/src/pages/TenantSettings/Subscription/index.tsx +++ b/packages/console/src/pages/TenantSettings/Subscription/index.tsx @@ -34,17 +34,19 @@ function Subscription() { useEffect(() => { if (isCloud) { onCurrentSubscriptionUpdated(); - - if (periodicUsage) { - updateTenant(currentTenantId, { - usage: { - activeUsers: periodicUsage.mauLimit, - tokenUsage: periodicUsage.tokenLimit, - }, - }); - } } - }, [currentTenantId, onCurrentSubscriptionUpdated, periodicUsage, updateTenant]); + }, [onCurrentSubscriptionUpdated]); + + useEffect(() => { + if (isCloud && periodicUsage) { + updateTenant(currentTenantId, { + usage: { + activeUsers: periodicUsage.mauLimit, + tokenUsage: periodicUsage.tokenLimit, + }, + }); + } + }, [currentTenantId, periodicUsage, updateTenant]); if (isLoading) { return ;