Skip to content

Commit

Permalink
chore: remove unused arguments from usePaymentCompleteHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
frosso committed Feb 28, 2025
1 parent ec98a59 commit a2c68da
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
5 changes: 5 additions & 0 deletions changelog/chore-usePaymentCompleteHandler-unused-arguments
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: chore: remove unused arguments from usePaymentCompleteHandler


4 changes: 1 addition & 3 deletions client/checkout/blocks/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import {

export const usePaymentCompleteHandler = (
api,
stripe,
elements,
onCheckoutSuccess,
emitResponse,
shouldSavePayment
Expand All @@ -33,7 +31,7 @@ export const usePaymentCompleteHandler = (
),
// not sure if we need to disable this, but kept it as-is to ensure nothing breaks. Please consider passing all the deps.
// eslint-disable-next-line react-hooks/exhaustive-deps
[ elements, stripe, api, shouldSavePayment ]
[ api, shouldSavePayment ]
);
};

Expand Down
9 changes: 1 addition & 8 deletions client/checkout/blocks/payment-processor.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
/**
* External dependencies
*/
import {
PaymentElement,
useElements,
useStripe,
} from '@stripe/react-stripe-js';
import { PaymentElement, useElements } from '@stripe/react-stripe-js';
import {
getPaymentMethods,
// eslint-disable-next-line import/no-unresolved
Expand Down Expand Up @@ -70,7 +66,6 @@ const PaymentProcessor = ( {
onLoadError = noop,
theme,
} ) => {
const stripe = useStripe();
const elements = useElements();
const hasLoadErrorRef = useRef( false );
const linkCleanupRef = useRef( null );
Expand Down Expand Up @@ -269,8 +264,6 @@ const PaymentProcessor = ( {

usePaymentCompleteHandler(
api,
stripe,
elements,
onCheckoutSuccess,
emitResponse,
shouldSavePayment
Expand Down
4 changes: 0 additions & 4 deletions client/checkout/blocks/saved-token-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import { removeLinkButton } from '../stripe-link';

export const SavedTokenHandler = ( {
api,
stripe,
elements,
eventRegistration: { onPaymentSetup, onCheckoutSuccess },
emitResponse,
} ) => {
Expand Down Expand Up @@ -38,8 +36,6 @@ export const SavedTokenHandler = ( {
// Once the server has completed payment processing, confirm the intent of necessary.
usePaymentCompleteHandler(
api,
stripe,
elements,
onCheckoutSuccess,
emitResponse,
false // No need to save a payment that has already been saved.
Expand Down

0 comments on commit a2c68da

Please sign in to comment.