mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
🐛 Revert logic to call setPaymentComponent
Before the change, the paymentComponent always was null, as it was not set anywhere.
This commit is contained in:
parent
78e0da27a1
commit
243630ea5d
2 changed files with 13 additions and 8 deletions
|
@ -1,6 +1,10 @@
|
|||
import { useEffect, useCallback } from '@wordpress/element';
|
||||
|
||||
const usePaymentSetupEffect = ( onPaymentSetup, handlePaymentSetup ) => {
|
||||
const usePaymentSetupEffect = (
|
||||
onPaymentSetup,
|
||||
handlePaymentSetup,
|
||||
setPaymentComponent
|
||||
) => {
|
||||
/**
|
||||
* `onPaymentSetup()` fires when we enter the "PROCESSING" state in the checkout flow.
|
||||
* It pre-processes the payment details and returns data for server-side processing.
|
||||
|
@ -13,10 +17,12 @@ const usePaymentSetupEffect = ( onPaymentSetup, handlePaymentSetup ) => {
|
|||
};
|
||||
}, [ onPaymentSetup, handlePaymentSetup ] );
|
||||
|
||||
const handlePaymentLoad = useCallback( ( component ) => {
|
||||
// We'll return this function instead of calling setPaymentComponent directly
|
||||
return component;
|
||||
}, [] );
|
||||
const handlePaymentLoad = useCallback(
|
||||
( component ) => {
|
||||
setPaymentComponent( component );
|
||||
},
|
||||
[ setPaymentComponent ]
|
||||
);
|
||||
|
||||
return { handlePaymentLoad };
|
||||
};
|
||||
|
|
|
@ -6,7 +6,6 @@ import useFastlaneSdk from './hooks/useFastlaneSdk';
|
|||
import useTokenizeCustomerData from './hooks/useTokenizeCustomerData';
|
||||
import useCardChange from './hooks/useCardChange';
|
||||
import useAxoSetup from './hooks/useAxoSetup';
|
||||
import usePaymentSetup from './hooks/usePaymentSetup';
|
||||
import useAxoCleanup from './hooks/useAxoCleanup';
|
||||
import useHandlePaymentSetup from './hooks/useHandlePaymentSetup';
|
||||
|
||||
|
@ -47,11 +46,11 @@ const Axo = ( props ) => {
|
|||
setShippingAddress,
|
||||
setCard
|
||||
);
|
||||
usePaymentSetup( onPaymentSetup, emitResponse, card );
|
||||
|
||||
const { handlePaymentLoad } = usePaymentSetupEffect(
|
||||
onPaymentSetup,
|
||||
handlePaymentSetup
|
||||
handlePaymentSetup,
|
||||
setPaymentComponent
|
||||
);
|
||||
|
||||
useAxoCleanup();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue