Skip to content

Commit 7f5cb97

Browse files
committed
Revert "wip"
This reverts commit 7fc1248.
1 parent 7fc1248 commit 7f5cb97

File tree

4 files changed

+5
-58
lines changed

4 files changed

+5
-58
lines changed

packages/clerk-js/src/core/lazy-query-client.ts

Lines changed: 0 additions & 47 deletions
This file was deleted.

packages/clerk-js/src/core/resources/BillingCheckout.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import type {
1212
import { unixEpochToDate } from '@/utils/date';
1313

1414
import { billingTotalsFromJSON } from '../../utils';
15-
import { lazyQueryController } from '../lazy-query-client';
1615
import { BillingPayer } from './BillingPayer';
1716
import { BaseResource, BillingPaymentSource, BillingPlan } from './internal';
1817

@@ -55,11 +54,11 @@ export class BillingCheckout extends BaseResource implements BillingCheckoutReso
5554
return this;
5655
}
5756

58-
confirm = async (params: ConfirmCheckoutParams): Promise<this> => {
57+
confirm = (params: ConfirmCheckoutParams): Promise<this> => {
5958
// Retry confirmation in case of a 500 error
6059
// This will retry up to 3 times with an increasing delay
6160
// It retries at 2s, 4s, 6s and 8s
62-
const result = await retry(
61+
return retry(
6362
() =>
6463
this._basePatch({
6564
path: this.payer.organizationId
@@ -86,9 +85,5 @@ export class BillingCheckout extends BaseResource implements BillingCheckoutReso
8685
},
8786
},
8887
);
89-
90-
// TODO: We can use the public bus instead.
91-
lazyQueryController.invalidate({ queryKey: ['commerce-subscription'] });
92-
return result;
9388
};
9489
}

packages/clerk-js/src/core/resources/BillingSubscription.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import type {
1313
import { unixEpochToDate } from '@/utils/date';
1414

1515
import { billingMoneyAmountFromJSON } from '../../utils';
16-
import { lazyQueryController } from '../lazy-query-client';
1716
import { BaseResource, BillingPlan, DeletedObject } from './internal';
1817

1918
export class BillingSubscription extends BaseResource implements BillingSubscriptionResource {
@@ -118,7 +117,6 @@ export class BillingSubscriptionItem extends BaseResource implements BillingSubs
118117
})
119118
)?.response as unknown as DeletedObjectJSON;
120119

121-
lazyQueryController.invalidate({ queryKey: ['commerce-subscription'] });
122120
return new DeletedObject(json);
123121
}
124122
}

packages/clerk-js/src/ui/contexts/components/Plans.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export const usePlansContext = () => {
115115
return false;
116116
}, [clerk, subscriberType]);
117117

118-
const { subscriptionItems, data: topLevelSubscription } = useSubscription();
118+
const { subscriptionItems, revalidate: revalidateSubscriptions, data: topLevelSubscription } = useSubscription();
119119

120120
// Invalidates cache but does not fetch immediately
121121
const { data: plans, revalidate: revalidatePlans } = usePlans({ mode: 'cache' });
@@ -127,10 +127,11 @@ export const usePlansContext = () => {
127127

128128
const revalidateAll = useCallback(() => {
129129
// Revalidate the plans and subscriptions
130+
void revalidateSubscriptions();
130131
void revalidatePlans();
131132
void revalidateStatements();
132133
void revalidatePaymentSources();
133-
}, [revalidatePlans, revalidateStatements, revalidatePaymentSources]);
134+
}, [revalidateSubscriptions, revalidatePlans, revalidateStatements, revalidatePaymentSources]);
134135

135136
// should the default plan be shown as active
136137
const isDefaultPlanImplicitlyActiveOrUpcoming = useMemo(() => {

0 commit comments

Comments
 (0)