mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Axo Block: Make sure the container exists before trying to render the Card component
This commit is contained in:
parent
af9eca7ef6
commit
12fc44eaa7
1 changed files with 6 additions and 2 deletions
|
@ -42,8 +42,12 @@ export const Payment = ( { fastlaneSdk, onPaymentLoad } ) => {
|
|||
const paymentComponent = await fastlaneSdk.FastlaneCardComponent(
|
||||
{}
|
||||
);
|
||||
paymentComponent.render( `#fastlane-card` );
|
||||
onPaymentLoad( paymentComponent );
|
||||
// Check if the container exists before rendering
|
||||
const cardContainer = document.querySelector( '#fastlane-card' );
|
||||
if ( cardContainer ) {
|
||||
paymentComponent.render( `#fastlane-card` );
|
||||
onPaymentLoad( paymentComponent );
|
||||
}
|
||||
}
|
||||
}, [
|
||||
isGuest,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue