Skip to content

Commit

Permalink
invalidate the pattern category cache when a new category is added
Browse files Browse the repository at this point in the history
  • Loading branch information
glendaviesnz committed Aug 29, 2023
1 parent 5c9e4a6 commit 5b368a3
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function DuplicateMenuItem( {
label = __( 'Duplicate' ),
onClose,
} ) {
const { saveEntityRecord } = useDispatch( coreStore );
const { saveEntityRecord, invalidateResolution } = useDispatch( coreStore );
const { createErrorNotice, createSuccessNotice } =
useDispatch( noticesStore );

Expand Down Expand Up @@ -121,6 +121,7 @@ export default function DuplicateMenuItem( {
throwOnError: true,
}
);
invalidateResolution( 'getUserPatternCategories' );
return newTerm.id;
} catch ( error ) {
if ( error.code !== 'term_exists' ) {
Expand Down

0 comments on commit 5b368a3

Please sign in to comment.