diff --git a/modules/ppcp-settings/resources/js/Components/Screens/Settings/Components/Styling/Content/PaymentMethods.js b/modules/ppcp-settings/resources/js/Components/Screens/Settings/Components/Styling/Content/PaymentMethods.js index 9b2d28cfb..191898b45 100644 --- a/modules/ppcp-settings/resources/js/Components/Screens/Settings/Components/Styling/Content/PaymentMethods.js +++ b/modules/ppcp-settings/resources/js/Components/Screens/Settings/Components/Styling/Content/PaymentMethods.js @@ -2,17 +2,21 @@ import { __ } from '@wordpress/i18n'; import { PaymentHooks, StylingHooks } from '../../../../../../data'; import { CheckboxStylingSection } from '../Layout'; +import { useMemo } from '@wordpress/element'; const SectionPaymentMethods = ( { location } ) => { const { paymentMethods, setPaymentMethods, choices } = StylingHooks.usePaymentMethodProps( location ); - const { all: allMethods } = PaymentHooks.usePaymentMethods(); - const filteredChoices = choices.filter( ( choice ) => { - const methodConfig = allMethods.find( ( i ) => i.id === choice.value ); - return methodConfig?.enabled; - } ); + const filteredChoices = useMemo( () => { + return choices.filter( ( choice ) => { + const methodConfig = allMethods.find( + ( i ) => i.id === choice.value + ); + return methodConfig?.enabled; + } ); + }, [ choices, allMethods ] ); return (