Skip to content

Commit

Permalink
Site Editor: Fix error when duplicating a template part (WordPress#63663
Browse files Browse the repository at this point in the history
)


Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Co-authored-by: Rishit30G <rishit30g@git.wordpress.org>
  • Loading branch information
4 people authored and carstingaxion committed Jul 18, 2024
1 parent c8fdd99 commit 92dcd6f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/editor/src/components/post-actions/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -934,11 +934,16 @@ export const duplicateTemplatePartAction = {
const blocks = useMemo( () => {
return (
item.blocks ??
parse( item.content.raw, {
__unstableSkipMigrationLogs: true,
} )
parse(
typeof item.content === 'string'
? item.content
: item.content.raw,
{
__unstableSkipMigrationLogs: true,
}
)
);
}, [ item?.content?.raw, item.blocks ] );
}, [ item.content, item.blocks ] );
const { createSuccessNotice } = useDispatch( noticesStore );
function onTemplatePartSuccess() {
createSuccessNotice(
Expand Down

0 comments on commit 92dcd6f

Please sign in to comment.