Don't load contents of payment method hidden tabs (https://github.com/woocommerce/woocommerce-blocks/pull/3227)

This commit is contained in:
Albert Juhé Lluveras 2020-10-05 15:25:40 +02:00 committed by GitHub
parent e486b8b906
commit 2f7b0ba3b4
2 changed files with 5 additions and 5 deletions

View File

@ -69,7 +69,8 @@ const Tabs = ( {
tabId={ `${ instanceId }-${ name }` } tabId={ `${ instanceId }-${ name }` }
className="wc-block-components-tabs__content" className="wc-block-components-tabs__content"
> >
{ content } { tabState.selectedId === `${ instanceId }-${ name }` &&
content }
</TabPanel> </TabPanel>
) ) } ) ) }
</div> </div>

View File

@ -7,7 +7,6 @@ import { useState } from '@wordpress/element';
/** /**
* Internal dependencies * Internal dependencies
*/ */
import { PAYMENT_METHOD_NAME } from './constants';
import { getStripeServerData } from '../stripe-utils'; import { getStripeServerData } from '../stripe-utils';
import { useCheckoutSubscriptions } from './use-checkout-subscriptions'; import { useCheckoutSubscriptions } from './use-checkout-subscriptions';
import { InlineCard, CardElements } from './elements'; import { InlineCard, CardElements } from './elements';
@ -83,11 +82,11 @@ const CreditCardComponent = ( {
export const StripeCreditCard = ( props ) => { export const StripeCreditCard = ( props ) => {
const { locale } = getStripeServerData().button; const { locale } = getStripeServerData().button;
const { activePaymentMethod, stripe } = props; const { stripe } = props;
return activePaymentMethod === PAYMENT_METHOD_NAME ? ( return (
<Elements stripe={ stripe } locale={ locale }> <Elements stripe={ stripe } locale={ locale }>
<CreditCardComponent { ...props } /> <CreditCardComponent { ...props } />
</Elements> </Elements>
) : null; );
}; };