Skip to content

Commit

Permalink
Site Editor: Fix error when duplicating a template part (#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 Jul 17, 2024
1 parent 8a20598 commit e5b6eb2
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 e5b6eb2

Please sign in to comment.