Skip to content

Commit

Permalink
chore: remove useNewSubscriptionData manual updateTenant
Browse files Browse the repository at this point in the history
  • Loading branch information
darcyYe committed Oct 22, 2024
1 parent 27e44c2 commit 8db2d86
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { cond, condString, pick } from '@silverhand/essentials';
import { useContext, useEffect, useMemo } from 'react';
import { cond, condString } from '@silverhand/essentials';
import { useContext, useMemo } from 'react';
import useSWR from 'swr';

import { useCloudApi } from '@/cloud/hooks/use-cloud-api';
Expand Down Expand Up @@ -50,13 +50,7 @@ const useNewSubscriptionData: () => NewSubscriptionContext & { isLoading: boolea
[currentTenant?.planId, logtoSkus]
);

useEffect(() => {
if (subscriptionUsageData?.quota) {
updateTenant(tenantId, {
quota: pick(subscriptionUsageData.quota, 'mauLimit', 'tokenLimit'),
});
}
}, [tenantId, subscriptionUsageData?.quota, updateTenant]);
// TODO: @darcyYe can use `updateTenant()` to manually update the quota of the current tenant. Previously we removed such logic to unblock the release since it breaks the Cloud console integration tests.

Check warning on line 53 in packages/console/src/contexts/SubscriptionDataProvider/use-new-subscription-data.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/console/src/contexts/SubscriptionDataProvider/use-new-subscription-data.ts#L53

[no-warning-comments] Unexpected 'todo' comment: 'TODO: @darcyYe can use `updateTenant()`...'.

return useMemo(
() => ({
Expand Down

0 comments on commit 8db2d86

Please sign in to comment.