Skip to content

Commit

Permalink
chore: remove unnecessary useEffect on settings toggle (#10449)
Browse files Browse the repository at this point in the history
  • Loading branch information
frosso authored Feb 26, 2025
1 parent c5ef672 commit 9574dc5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
5 changes: 5 additions & 0 deletions changelog/chore-remove-unneeded-useeffect-in-settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: chore: remove unnecessary useEffect on settings toggle


9 changes: 0 additions & 9 deletions client/settings/advanced-settings/multi-currency-toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/
import { CheckboxControl, ExternalLink } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { useEffect, useRef } from '@wordpress/element';

/**
* Internal dependencies
Expand All @@ -17,14 +16,6 @@ const MultiCurrencyToggle = () => {
updateIsMultiCurrencyEnabled,
] = useMultiCurrency();

const headingRef = useRef( null );

useEffect( () => {
if ( ! headingRef.current ) return;

headingRef.current.focus();
}, [] );

const handleMultiCurrencyStatusChange = ( value ) => {
updateIsMultiCurrencyEnabled( value );
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/
import { CheckboxControl, ExternalLink } from '@wordpress/components';
import { __, sprintf } from '@wordpress/i18n';
import { useEffect, useRef } from '@wordpress/element';

/**
* Internal dependencies
Expand All @@ -18,14 +17,6 @@ const WCPaySubscriptionsToggle = () => {
updateIsWCPaySubscriptionsEnabled,
] = useWCPaySubscriptions();

const headingRef = useRef( null );

useEffect( () => {
if ( ! headingRef.current ) return;

headingRef.current.focus();
}, [] );

const handleWCPaySubscriptionsStatusChange = ( value ) => {
updateIsWCPaySubscriptionsEnabled( value );
};
Expand Down

0 comments on commit 9574dc5

Please sign in to comment.