Skip to content

Commit

Permalink
Editor: Avoid triggering the start page modal on unsaved pages (#61082)
Browse files Browse the repository at this point in the history
Co-authored-by: youknowriad <[email protected]>
Co-authored-by: richtabor <[email protected]>
  • Loading branch information
3 people authored Apr 25, 2024
1 parent 470f11e commit 9cc96a7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/editor/src/components/start-page-options/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import { useSelect, useDispatch } from '@wordpress/data';
import { useAsyncList } from '@wordpress/compose';
import { store as coreStore } from '@wordpress/core-data';
import { __unstableSerializeAndClean } from '@wordpress/blocks';

/**
* Internal dependencies
Expand Down Expand Up @@ -71,7 +72,11 @@ function PatternSelection( { blockPatterns, onChoosePattern } ) {
blockPatterns={ blockPatterns }
shownPatterns={ shownBlockPatterns }
onClickPattern={ ( _pattern, blocks ) => {
editEntityRecord( 'postType', postType, postId, { blocks } );
editEntityRecord( 'postType', postType, postId, {
blocks,
content: ( { blocks: blocksForSerialization = [] } ) =>
__unstableSerializeAndClean( blocksForSerialization ),
} );
onChoosePattern();
} }
/>
Expand Down

0 comments on commit 9cc96a7

Please sign in to comment.