🔥 Remove useless state value

This commit is contained in:
Philipp Stracker 2024-09-16 17:56:00 +02:00
parent c8fd798f62
commit b05a3e933f
No known key found for this signature in database
3 changed files with 4 additions and 9 deletions

View file

@ -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' );

View file

@ -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;

View file

@ -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(