mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 14:57:26 +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.
|
||||
const debouncedUpdatePhone = useRef(
|
||||
debounce( ( number, component ) => {
|
||||
updatePrefills( component, number );
|
||||
}, PHONE_DEBOUNCE_DELAY )
|
||||
debounce( updatePrefills, PHONE_DEBOUNCE_DELAY )
|
||||
).current;
|
||||
|
||||
// Invoke debounced function when paymentComponent or phoneNumber changes.
|
||||
useEffect( () => {
|
||||
if ( paymentComponent && phoneNumber ) {
|
||||
debouncedUpdatePhone( phoneNumber, paymentComponent );
|
||||
debouncedUpdatePhone( paymentComponent, phoneNumber );
|
||||
}
|
||||
}, [ debouncedUpdatePhone, paymentComponent, phoneNumber ] );
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue