Skip to content

Commit

Permalink
Fix duplicate template parts logic overriding existing template part (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewserong authored Jan 16, 2023
1 parent e48f067 commit 3699b70
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ export default function NewTemplatePart( {
}

try {
const cleanSlug = getCleanTemplatePartSlug( title );
const uniqueTitle = getUniqueTemplatePartTitle(
title,
existingTemplateParts
);
const cleanSlug = getCleanTemplatePartSlug( uniqueTitle );

const templatePart = await saveEntityRecord(
'postType',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ export default function ConvertToTemplatePart( { clientIds, blocks } ) {
}

const onConvert = async ( { title, area } ) => {
const cleanSlug = getCleanTemplatePartSlug( title );
const uniqueTitle = getUniqueTemplatePartTitle(
title,
existingTemplateParts
);
const cleanSlug = getCleanTemplatePartSlug( uniqueTitle );

const templatePart = await saveEntityRecord(
'postType',
Expand Down

0 comments on commit 3699b70

Please sign in to comment.