♻️ Minor simplification

This commit is contained in:
Philipp Stracker 2024-09-16 18:27:42 +02:00
parent b05a3e933f
commit 119fdec839
No known key found for this signature in database

View file

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