mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
♻️ Minor simplification
This commit is contained in:
parent
b05a3e933f
commit
119fdec839
1 changed files with 2 additions and 4 deletions
|
@ -56,15 +56,13 @@ export const usePhoneSyncHandler = ( paymentComponent ) => {
|
||||||
|
|
||||||
// Create a debounced function that updates the prefilled phone-number.
|
// Create a debounced function that updates the prefilled phone-number.
|
||||||
const debouncedUpdatePhone = useRef(
|
const debouncedUpdatePhone = useRef(
|
||||||
debounce( ( number, component ) => {
|
debounce( updatePrefills, PHONE_DEBOUNCE_DELAY )
|
||||||
updatePrefills( component, number );
|
|
||||||
}, PHONE_DEBOUNCE_DELAY )
|
|
||||||
).current;
|
).current;
|
||||||
|
|
||||||
// Invoke debounced function when paymentComponent or phoneNumber changes.
|
// Invoke debounced function when paymentComponent or phoneNumber changes.
|
||||||
useEffect( () => {
|
useEffect( () => {
|
||||||
if ( paymentComponent && phoneNumber ) {
|
if ( paymentComponent && phoneNumber ) {
|
||||||
debouncedUpdatePhone( phoneNumber, paymentComponent );
|
debouncedUpdatePhone( paymentComponent, phoneNumber );
|
||||||
}
|
}
|
||||||
}, [ debouncedUpdatePhone, paymentComponent, phoneNumber ] );
|
}, [ debouncedUpdatePhone, paymentComponent, phoneNumber ] );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue