Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Update payout-invoice-sheet.tsx

Kiran K356d20996614
diff --git a/apps/web/ui/partners/payout-invoice-sheet.tsx b/apps/web/ui/partners/payout-invoice-sheet.tsx
index 1ab82d8cc0..66b67e22e1 100644
--- a/apps/web/ui/partners/payout-invoice-sheet.tsx
+++ b/apps/web/ui/partners/payout-invoice-sheet.tsx
@@ -57,12 +57,6 @@ function PayoutInvoiceSheetContent({ setIsOpen }: PayoutInvoiceSheetProps) {
},
});
- useEffect(() => {
- if (paymentMethods && paymentMethods.length > 0 && !payoutMethodId) {
- setPayoutMethodId(paymentMethods[0].id);
- }
- }, [paymentMethods, payoutMethodId]);
-
const { executeAsync, isExecuting } = useAction(confirmPayoutsAction, {
onSuccess: async () => {
toast.success(
@@ -87,6 +81,12 @@ function PayoutInvoiceSheetContent({ setIsOpen }: PayoutInvoiceSheetProps) {
[payouts],
);
+ useEffect(() => {
+ if (paymentMethods && paymentMethods.length > 0 && !payoutMethodId) {
+ setPayoutMethodId(paymentMethods[0].id);
+ }
+ }, [paymentMethods, payoutMethodId]);
+
const invoiceData = useMemo(() => {
const paymentMethodOption = (paymentMethod: Stripe.PaymentMethod) => {
const paymentMethods = {
@@ -182,7 +182,7 @@ function PayoutInvoiceSheetContent({ setIsOpen }: PayoutInvoiceSheetProps) {
maximumFractionDigits: 2,
}),
};
- }, [selectedPayouts, paymentMethods]);
+ }, [selectedPayouts, paymentMethods, payoutMethodId]);
const table = useTable({
data: pendingPayouts || [],