Skip to content

Commit

Permalink
Pull in changes to nav notices
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave committed Mar 4, 2022
1 parent 2154b9a commit fdf1e0e
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ import { useRef } from '@wordpress/element';
import { useDispatch } from '@wordpress/data';
import { store as noticeStore } from '@wordpress/notices';

function useNavigationNotice( { name, message } = {} ) {
function useNavigationNotice( { name, message = '' } = {} ) {
const noticeRef = useRef();

const { createWarningNotice, removeNotice } = useDispatch( noticeStore );

const showNotice = () => {
const showNotice = ( customMsg ) => {
if ( noticeRef.current ) {
return;
}

noticeRef.current = name;

createWarningNotice( message, {
createWarningNotice( customMsg || message, {
id: noticeRef.current,
type: 'snackbar',
} );
Expand Down

0 comments on commit fdf1e0e

Please sign in to comment.