Skip to content

Commit

Permalink
Avoid flickering effect when Payouts is loading but notice is dismissed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jessy committed Nov 6, 2024
1 parent f8f32c3 commit 76e9556
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions client/deposits/rename-notice/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ import { createInterpolateElement } from '@wordpress/element';
/**
* Internal dependencies
*/
import { useDeposits } from 'wcpay/data';

Check warning on line 13 in client/deposits/rename-notice/index.tsx

View workflow job for this annotation

GitHub Actions / JS linting

'useDeposits' is defined but never used
import './style.scss';

export const PayoutsRenameNotice = () => {
const isPayoutsRenameNoticeDismissed =
wcpaySettings.isPayoutsRenameNoticeDismissed;
const { updateOptions } = useDispatch( 'wc/admin/options' );
const [ showTour, setShowTour ] = useState( true );
const [ showTour, setShowTour ] = useState( false );

const onClose = () => {
updateOptions( {
Expand All @@ -27,7 +28,9 @@ export const PayoutsRenameNotice = () => {
};

useEffect( () => {
setShowTour( ! isPayoutsRenameNoticeDismissed );
if ( ! isPayoutsRenameNoticeDismissed ) {
setShowTour( true );
}
}, [ isPayoutsRenameNoticeDismissed ] );

if ( ! showTour ) return null;
Expand Down

0 comments on commit 76e9556

Please sign in to comment.