mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 09:08:09 +08:00
🔥 Remove useless state value
This commit is contained in:
parent
c8fd798f62
commit
b05a3e933f
3 changed files with 4 additions and 9 deletions
|
@ -17,8 +17,7 @@ const useAxoSetup = (
|
|||
paymentComponent,
|
||||
onChangeCardButtonClick,
|
||||
setShippingAddress,
|
||||
setCard,
|
||||
setWooPhone
|
||||
setCard
|
||||
) => {
|
||||
const { setIsAxoActive, setIsAxoScriptLoaded } = useDispatch( STORE_NAME );
|
||||
const paypalLoaded = usePayPalScript( ppcpConfig );
|
||||
|
@ -35,7 +34,7 @@ const useAxoSetup = (
|
|||
setBillingAddress: setWooBillingAddress,
|
||||
} = useCustomerData();
|
||||
|
||||
usePhoneSyncHandler( paymentComponent, setWooPhone );
|
||||
usePhoneSyncHandler( paymentComponent );
|
||||
|
||||
useEffect( () => {
|
||||
console.log( 'Initializing class toggles' );
|
||||
|
|
|
@ -46,10 +46,9 @@ const updatePrefills = ( paymentComponent, phoneNumber ) => {
|
|||
/**
|
||||
* Custom hook to synchronize the WooCommerce phone number with a React component state.
|
||||
*
|
||||
* @param {Function} setWooPhone - The state setter function for the phone number.
|
||||
* @param {Object} paymentComponent - The CardField component from Fastlane.
|
||||
*/
|
||||
export const usePhoneSyncHandler = ( paymentComponent, setWooPhone ) => {
|
||||
export const usePhoneSyncHandler = ( paymentComponent ) => {
|
||||
// Fetch and sanitize phone number from WooCommerce.
|
||||
const phoneNumber = useSelect( ( select ) =>
|
||||
getSanitizedPhoneNumber( select )
|
||||
|
@ -58,7 +57,6 @@ export const usePhoneSyncHandler = ( paymentComponent, setWooPhone ) => {
|
|||
// Create a debounced function that updates the prefilled phone-number.
|
||||
const debouncedUpdatePhone = useRef(
|
||||
debounce( ( number, component ) => {
|
||||
setWooPhone( number );
|
||||
updatePrefills( component, number );
|
||||
}, PHONE_DEBOUNCE_DELAY )
|
||||
).current;
|
||||
|
|
|
@ -27,7 +27,6 @@ const Axo = ( props ) => {
|
|||
const { onPaymentSetup } = eventRegistration;
|
||||
const [ shippingAddress, setShippingAddress ] = useState( null );
|
||||
const [ card, setCard ] = useState( null );
|
||||
const [ wooPhone, setWooPhone ] = useState( '' );
|
||||
const [ paymentComponent, setPaymentComponent ] = useState( null );
|
||||
|
||||
const fastlaneSdk = useFastlaneSdk( axoConfig, ppcpConfig );
|
||||
|
@ -46,8 +45,7 @@ const Axo = ( props ) => {
|
|||
paymentComponent,
|
||||
onChangeCardButtonClick,
|
||||
setShippingAddress,
|
||||
setCard,
|
||||
setWooPhone
|
||||
setCard
|
||||
);
|
||||
|
||||
const { handlePaymentLoad } = usePaymentSetupEffect(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue