mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 14:57:26 +08:00
🐛 Check if cancel is possible before calling it
This commit is contained in:
parent
119fdec839
commit
85ad2f8edb
1 changed files with 3 additions and 1 deletions
|
@ -69,7 +69,9 @@ export const usePhoneSyncHandler = ( paymentComponent ) => {
|
|||
// Cleanup on unmount, canceling any pending debounced calls.
|
||||
useEffect( () => {
|
||||
return () => {
|
||||
debouncedUpdatePhone.cancel();
|
||||
if ( debouncedUpdatePhone?.cancel ) {
|
||||
debouncedUpdatePhone.cancel();
|
||||
}
|
||||
};
|
||||
}, [ debouncedUpdatePhone ] );
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue