Skip to content

Commit

Permalink
Fix PAX confirm notification button does not dismiss the notification…
Browse files Browse the repository at this point in the history
… from the screen.
  • Loading branch information
jimmymadon committed Oct 16, 2024
1 parent b794b7d commit f208880
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import { __ } from '@wordpress/i18n';
/**
* Internal dependencies
*/
import { useDispatch } from 'googlesitekit-data';
import { CORE_NOTIFICATIONS } from '../../../../googlesitekit/notifications/datastore/constants';
import { getNavigationalScrollTop } from '../../../../util/scroll';
import SubtleNotification from '../../../../googlesitekit/notifications/components/layout/SubtleNotification';
import useQueryArg from '../../../../hooks/useQueryArg';
Expand All @@ -37,9 +39,11 @@ export default function PAXSetupSuccessSubtleNotification( {
} ) {
const breakpoint = useBreakpoint();

const { dismissNotification } = useDispatch( CORE_NOTIFICATIONS );

const [ , setNotification ] = useQueryArg( 'notification' );

const onDismiss = () => {
const dismissNotice = () => {
setNotification( undefined );
};

Expand All @@ -54,7 +58,8 @@ export default function PAXSetupSuccessSubtleNotification( {
behavior: 'smooth',
} );

setNotification( undefined );
dismissNotice();
dismissNotification( id );
}, 50 );
};

Expand All @@ -74,7 +79,7 @@ export default function PAXSetupSuccessSubtleNotification( {
id={ id }
primary={ false }
dismissLabel={ __( 'Got it', 'google-site-kit' ) }
onDismiss={ onDismiss }
onDismiss={ dismissNotice }
/>
}
additionalCTA={
Expand Down

0 comments on commit f208880

Please sign in to comment.