File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
packages/block-library/src/block Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -140,7 +140,7 @@ export default function ReusableBlockEdit( {
140140} ) {
141141 const registry = useRegistry ( ) ;
142142 const hasAlreadyRendered = useHasRecursion ( ref ) ;
143- const { record, hasResolved } = useEntityRecord (
143+ const { record, editedRecord , hasResolved } = useEntityRecord (
144144 'postType' ,
145145 'wp_block' ,
146146 ref
@@ -156,9 +156,13 @@ export default function ReusableBlockEdit( {
156156 const { getBlockEditingMode } = useSelect ( blockEditorStore ) ;
157157
158158 useEffect ( ( ) => {
159- if ( ! record ?. content ?. raw ) return ;
160- const initialBlocks = parse ( record . content . raw ) ;
159+ const initialBlocks =
160+ editedRecord . blocks ??
161+ ( editedRecord . content && typeof editedRecord . content !== 'function'
162+ ? parse ( editedRecord . content )
163+ : [ ] ) ;
161164
165+ defaultValuesRef . current = { } ;
162166 const editingMode = getBlockEditingMode ( patternClientId ) ;
163167 registry . batch ( ( ) => {
164168 setBlockEditingMode ( patternClientId , 'default' ) ;
@@ -176,7 +180,7 @@ export default function ReusableBlockEdit( {
176180 } , [
177181 __unstableMarkNextChangeAsNotPersistent ,
178182 patternClientId ,
179- record ,
183+ editedRecord ,
180184 replaceInnerBlocks ,
181185 registry ,
182186 getBlockEditingMode ,
You can’t perform that action at this time.
0 commit comments