Skip to content

Commit 30601f7

Browse files
committed
fix: Flag payment method display props as optional
Since this can be used as a top level component, it may not receive them. We had the right type guards in place already, but the types weren’t accurate.
1 parent 875c139 commit 30601f7

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

src/features/organization/billing/paymentMethod/AddNewPaymentMethod.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useParams } from '@tanstack/react-router';
66

77
interface AddNewPaymentMethodProps {
88
readonly onPaymentAdded: (added: boolean) => void;
9-
readonly onSaveStateForBillingRedirect: (redirecting: boolean) => void;
9+
readonly onSaveStateForBillingRedirect?: (redirecting: boolean) => void;
1010
}
1111

1212
export function AddNewPaymentMethod({ onPaymentAdded, onSaveStateForBillingRedirect }: AddNewPaymentMethodProps) {

src/features/organization/billing/paymentMethod/AddNewPaymentMethodForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { toast } from 'sonner';
1111
interface AddNewPaymentMethodFormProps {
1212
readonly hasExistingBilling: boolean;
1313
readonly onPaymentAdded: (added: boolean) => void;
14-
readonly onSaveStateForBillingRedirect: (redirecting: boolean) => void;
14+
readonly onSaveStateForBillingRedirect?: (redirecting: boolean) => void;
1515
}
1616

1717
export function AddNewPaymentMethodForm({

src/features/organization/billing/paymentMethod/PaymentMethodsDisplay.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@ import { useCallback, useState } from 'react';
1616
const route = getRouteApi('');
1717

1818
interface PaymentMethodsDisplayProps {
19-
onSaveStateForBillingRedirect: (redirecting: boolean) => void;
20-
onReplacingPaymentMethod: (value: boolean) => void;
19+
onSaveStateForBillingRedirect?: (redirecting: boolean) => void;
20+
onReplacingPaymentMethod?: (value: boolean) => void;
2121
}
2222

23-
export function PaymentMethodsDisplay({
24-
onSaveStateForBillingRedirect,
25-
onReplacingPaymentMethod,
26-
}: PaymentMethodsDisplayProps) {
23+
export function PaymentMethodsDisplay(props?: PaymentMethodsDisplayProps) {
24+
const { onSaveStateForBillingRedirect, onReplacingPaymentMethod } = props ?? {};
2725
const { organizationId } = route.useParams();
2826
const { update } = useOrganizationPermissions(organizationId);
2927
const { data: organization, refetch } = useQuery(getOrganizationQueryOptions(organizationId));

0 commit comments

Comments
 (0)