Skip to content

Commit a408f6f

Browse files
committed
Clear visible admin notices when switching from editing a snippet to creating a new snippet.
1 parent ccc6d6d commit a408f6f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/js/components/SnippetForm/page/PageHeading.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useSnippetForm } from '../../../hooks/useSnippetForm'
66
const OPTIONS = window.CODE_SNIPPETS_EDIT
77

88
export const PageHeading: React.FC = () => {
9-
const { snippet, updateSnippet } = useSnippetForm()
9+
const { snippet, updateSnippet, setCurrentNotice } = useSnippetForm()
1010

1111
return (
1212
<h1>
@@ -18,6 +18,7 @@ export const PageHeading: React.FC = () => {
1818
<a href={window.CODE_SNIPPETS?.urls.addNew} className="page-title-action" onClick={event => {
1919
event.preventDefault()
2020
updateSnippet(() => createEmptySnippet())
21+
setCurrentNotice(undefined)
2122

2223
window.document.title = window.document.title.replace(
2324
__('Edit Snippet', 'code-snippets'),

0 commit comments

Comments
 (0)