Don't load contents of payment method hidden tabs (https://github.com/woocommerce/woocommerce-blocks/pull/3227)
This commit is contained in:
parent
e486b8b906
commit
2f7b0ba3b4
|
@ -69,7 +69,8 @@ const Tabs = ( {
|
|||
tabId={ `${ instanceId }-${ name }` }
|
||||
className="wc-block-components-tabs__content"
|
||||
>
|
||||
{ content }
|
||||
{ tabState.selectedId === `${ instanceId }-${ name }` &&
|
||||
content }
|
||||
</TabPanel>
|
||||
) ) }
|
||||
</div>
|
||||
|
|
|
@ -7,7 +7,6 @@ import { useState } from '@wordpress/element';
|
|||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { PAYMENT_METHOD_NAME } from './constants';
|
||||
import { getStripeServerData } from '../stripe-utils';
|
||||
import { useCheckoutSubscriptions } from './use-checkout-subscriptions';
|
||||
import { InlineCard, CardElements } from './elements';
|
||||
|
@ -83,11 +82,11 @@ const CreditCardComponent = ( {
|
|||
|
||||
export const StripeCreditCard = ( props ) => {
|
||||
const { locale } = getStripeServerData().button;
|
||||
const { activePaymentMethod, stripe } = props;
|
||||
const { stripe } = props;
|
||||
|
||||
return activePaymentMethod === PAYMENT_METHOD_NAME ? (
|
||||
return (
|
||||
<Elements stripe={ stripe } locale={ locale }>
|
||||
<CreditCardComponent { ...props } />
|
||||
</Elements>
|
||||
) : null;
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue